int min(int x,int y)
{
    
return x<y?x:y;
}
void RMQ()
{
    
int i,j;
    
for(i=1;i<=n;i++)dp[0][i]=a[i];
    for(j=1;j<=int(log((double)n)/log(2.0));j++)
    {
        
for(i=1;i+(1<<j)-1<=n;i++)
        {
            dp[j][i]
=min(dp[j-1][i],dp[j-1][i+(1<<(j-1))]);                      
        }                                        
    } 
}
int query(int i,int j)
{
    
int k=int(log((double)(j-i+1))/log(2.0)); 
    return min(dp[k][i],dp[k][j-(1<<k)+1]);
}    
int main()
{
    
int i,j,k,x,y;
    
while(scanf("%d%d",&n,&m)!=EOF)
    {
          
for(i=1;i<=n;i++)
          {
              scanf(
"%d",&a[i]);             
          }                 
          RMQ();
          
for(i=1;i<=m;i++)
          {
              scanf(
"%d%d",&x,&y);
              printf(
"min=%d\n",query(x,y));             
          }       
    }
    
return 0;
}