#include<bits/stdc++.h>
int cn[100005];
using namespace std;
int main()
{
    int n,m,r,c=0;
    cin>>n>>m;
    int a[n],b[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<=m)
        {
          c++;
        }
        b[i]=a[i];
    }
    if(c==n)
    {
        cout<<n<<endl;
    }
    else
    {
       queue<int >s;
  for(int i=0;i<n;i++)
  {
      if(a[i]>m)
      {
          a[i]=a[i]-m;
          s.push(i);

    }
  }
  int l=0;
  while(!s.empty())
  {
      cn[l]=s.front()+1;
     // cout<<cn[l]<<endl;
      l++;
     // cout<<"*"<<a[s.front()]<<endl;
     if(a[s.front()]>m)
     {

      // cout<<"*"<<a[s.front()]<<endl;

         a[s.front()]=a[s.front()]-m;

         s.push(s.front()); s.pop();
     }
     else
     {
      s.pop();
    }

  }
  cout<<cn[l-1]<<endl;
 }

}

#include <iostream>
#include <vector>
#include <map>
using namespace std;
 int main(){
     int n,m,temp;
     cin>>n>>m;
     map <int, int> umap;
     vector<int> v;
     for(int i=1;i<=n; i++)
        {cin>>temp; umap[i]=temp;}
    int last=n;
    int key,value;

    while(!umap.empty()){

         for(auto x:umap) {
             value=x.second-m;
             key=x.first;
             if(value<=0)
                    {v.push_back(key);}
             else
             {
                 umap[key]=value;
                  last=key;
             }
         }

        for(int i=0;i<v.size();i++){
            key=v[i];
           umap.erase(key);
        }
    }
     cout<<last<<endl;
     return 0;
 }

#include<iostream>
#include<cmath>
using namespace std;

int main(){
	int n,m;
	float temp=0,ultimo=-1,imprime=-1;
	cin>>n>>m;

	for(int i=0;i<n;i++){
		cin>>temp;

		if(ceil(temp/m)>=ceil(imprime/m)){
				imprime=temp;
				ultimo=i;

			}

	}

	cout<<ultimo+1<<endl;
}

#include <bits/stdc++.h>

using namespace std;

int max (int a[], int size, int m){
    int max = 0, ans = -1;
    for(int i = 0; i<size; i++){
        int cei = ((a[i] + m - 1) / m);
        if(cei >= max){
            max = cei;
            ans  = i+1;
        }
    }
return ans;

}

int main () {

    int n, p;
    cin >> n >> p;

    int arr[n];
    for(int i = 0; i<n; i++){
        cin >> arr[i];
    }

cout << max(arr, n, p);

}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define pb push_back

int main ()
{
	int n, m, j = 0;
	double a, max = 0;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> a;
		if (ceil(a / m) >= max) {
			max = ceil(a / m);
			j = i;
		}
	}
	cout << j;
	return 0;
}

#include<iostream>
#include<stack>
#include<queue>
using namespace std;

struct children
{
    int n, candies;
}a;

int main()
{
    int n, x, k;
    while (cin >> n >> k)
    {

        queue<children>q;
        for (int i = 1; i <= n; i++)
        {
            cin >> x;
            a.candies = x;
            a.n = i;
            q.push(a);
        }
        int temp;
        while (q.size() != 1)
        {
            q.front().candies -= k;
            if (q.front().candies <= 0)q.pop();
            else{
                a = q.front();
                q.push(a);
                q.pop();
            }
        }
        cout << q.front().n << endl;
    }
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int ch;
    int n,k;
    cin>>n>>k;int max,maxi;
    cin>>max;
    maxi=1;bool f=false;
    if(max>k)f=true;
    for(int i=2;i<=n;i++)
    {
        cin>>ch;
        if(ch>k)
        {
            f=true;
         max=ceil((double)max/k)<=ceil((double)ch/k)?ch:max;
         if(max==ch)
         maxi=i;
        }
    }
    if((f))
    cout<<maxi;
    else cout<<n;

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define CHK(x) cout << (#x) << " is " << (x) << endl;
#define PI acos(-1.0)
#define MAX 200005
#define MOD 1000000007
#define nl '\n'

//أعوذ بالله من الشيطان الرجيم
//بسم الله الرحمن الرحيم

int32_t main() {
    int n,m; cin>>n>>m;
    vector<pair<int,int>> v;
    double x;
    for(int i=1; i<=n; i++) {
        cin>>x;
        v.push_back(make_pair(ceil(x/m),i));
    }
    sort(v.begin(),v.end());
    cout<<v[n-1].second<<nl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

const int MAX_N = 100000;
int a[MAX_N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m, t, ans, curr = 0;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> t;
        if (t / m + (t % m ? 1 : 0) >= curr)
        {
            curr = t / m + (t % m ? 1 : 0);
            ans = i;
        }
    }
    cout << ans + 1;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    int n, m;
    cin >> n >> m;
    int mx = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        if ((v + m - 1) / m >= mx) {
            mx = (v + m - 1) / m;
            ans = i + 1;
        }
    }
    cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long n,m;
	int index;
	cin >> n;
    cin >> m;
    long long arr[n];
    int times[n];
    int max = INT_MIN;
    for(int i=0 ;i<n;i++)
    {
      cin >> arr[i];
    }

    for(int i=0;i<n;i++)
    {
    	if((arr[i]%m) == 0)
    	{
            times[i] = arr[i]/m;
    	}
    	else
    	{
           times[i] = (arr[i]/m) + 1;
    	}
    }

    for(int i=n-1;i>=0;i--)
    {
        if(times[i] > max)
        {
          max = times[i];
          index = i;
        }
    }

    cout << index + 1;
	return 0;
}

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <locale>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#include <iomanip>
#include <bitset>

using namespace std;

#define all(a)              (a).begin(), (a).end()
#define ms(a,b)             memset(a, b, sizeof(a))
#define mp                  make_pair
#define pb                  push_back
#define fore(it,a)          for (auto it = (a).begin(), it##_ = (a).end(); it != it##_; it++)
#define f0r(i, a)           for (int i = 0, end = (a); i < end; i++)
#define debug(args...)      do {cerr << #args << ": "; dbg,args; cerr << endl;} while(0)
#define read(type, args...) type args; rdr,args;
#define fi                  first
#define se                  second
#define bit_no              __builtin_popcount
#define left(a)             (2*(a))
#define right(a)            (2*(a)+1)
#define mid(left, right)    ((left+right)/2+1)

typedef long long           ll;
typedef long double         ld;
typedef unsigned long long  ull;
typedef vector<int>         vi;
typedef vector<vi>          vvi;
typedef pair<int, int>      ii;
typedef vector<ii>          vii;

const int inf = 2e8+5;
const ll l_inf = 9e18+5;

template<typename T,typename T2>
ostream& operator<< (ostream &s, const pair<T,T2> &p) {return s << p.fi << ' ' << p.se << ' ';}

template<typename T,typename T2>
istream& operator>> (istream &s, pair<T,T2> &p) {return s >> p.fi >> p.se;}

template<typename T>
ostream& operator<< (ostream &s, const vector<T> &v)  {for (auto it: v) s << it << ' '; return s;}

template<typename T>
istream& operator>> (istream &s, vector<T> &v) {fore (it, v) s >> *it; return s;}

template<typename T>
void read_range(T beg, T end)
{
        while (beg != end)
                    cin >> *beg++;
}

template<typename T>
void print_range(T beg, T end)
{
        while (beg != end)
                    cout << *beg++ << ' ';
}

struct reader
{
        template<typename T>
                reader& operator, (T &v)
                    {
                                cin >> v;
                                        return *this;
                                            }
} rdr;

struct debugger
{
        template<typename T>
                debugger& operator, (const T &v)
                    {
                                cerr << v << ", ";
                                        return *this;
                                            }
} dbg;

#define MAX_N 105

int ar[MAX_N];

int main()
{
    ios_base::sync_with_stdio(false);

    read(int, n, m);
    read_range(ar, ar+n);

    int last = 0;
    for (int i = 1; i < n; i++)
        if (ar[i]/m + (ar[i]%m ? 1 : 0) >= ar[last]/m + (ar[last]%m ? 1 : 0))
            last = i;

    cout << last+1;

    return 0;
}

#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;
const int maxn = 100;

int n, m, a[maxn+5];
queue<int> q;

int main(){
	while (scanf("%d%d",&n,&m) == 2){

            for (int i = 1;i <= n;++i) {cin >> a[i];q.push(i);}
int ans = 1;
		while (!q.empty()){
			int t = q.front();
			q.pop();
			if (m < a[t]) {q.push(t), a[t] -= m;}
			else ans = t;
		}

		printf("%d\n",ans);
	}

return 0;
}
/*

*/

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x;
	cin >> n >> m;
	vector<pair<int,int>>v;
	for(int i = 1 ; i <= n ; i++ ){
		cin >> x;
		v.emplace_back(make_pair(x,i));
	}
	if(n==1){
	    cout<<"1";
	    return 0;
	}
	pair<int,int>  ans;
	auto p = v.begin();
	while(v.size()>0){
		if(p->first<=m){
			v.erase(p);
		}
		else{
			v.push_back({p->first-m,p->second});
			v.erase(p);
		}
		if(v.size()>0)
		ans = v[v.size()-1];
	}
	cout<<ans.second;

}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define PB push_back
#define MP make_pair

int main()
{
        int n,m;
        cin>>n>>m;
        int arr[n];
        for(int i=0; i<n; i++)
        {
            cin>>arr[i];
        }
        for(int i=0; i<n; i++)
        {
           if(arr[i]%m==0)
           {
               arr[i] = arr[i]/m;
           }
           else
           {
               arr[i] = arr[i]/m + 1;
           }
         //  cout<<arr[i]<<"**";
        }
        int k = INT_MIN,j;
        for(int i=0; i<n; i++)
        {
            if(arr[i]>=k)
            {
                k = arr[i];
                j = i+1;
            }
        }
        cout<<j<<endl;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<cstdlib>

int main()
{
	int i,m,n,max=0,k=0,a;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a);
		if(a%m) a=a/m+1;
		else a/=m;
		if(a>=max)
		{
			max=a;
			k=i;
		}
	}
	printf("%d\n",k);
	return 0;
}

#include<stdio.h>
#include<queue>
using namespace std;
struct child{
    int no;
    int a;
};
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    child a[110];
    queue<child> b;
    for (int i = 0; i < n; i++)
    {
        scanf("%d",&a[i].a);
        a[i].no=i;
        b.push(a[i]);
    }
    while(b.size()!=1)
    {
        if(b.front().a>m)
        {
            b.front().a-=m;
            b.push(b.front());
            b.pop();
        }
        else b.pop();
    }
    printf("%d\n",b.front().no+1);
}

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int idx = 1, mx = 0;
  for (int i = 1, a; i <= n; ++i) {
    cin >> a;
    if ((a + m - 1) / m >= mx) {
      mx = (a + m - 1) / m;
      idx = i;
    }
  }
  cout << idx << '\n';
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int num=0,pos;
    for(int i=1;i<=n;i++){
        double a;
        cin>>a;
        if(ceil(a/m)>=num){
            num=ceil(a/m);
            pos=i;
        }
    }
    cout<<pos<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int a[101];
    int b[101];
    int n1=n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=i;
    }
    int i=0;
    while(n>1){
        if(b[i]!=-1){
            a[i]-=m;
            if(a[i]>0){
                b[i]+=n;
            }else{
                b[i]=-1;
                n--;
            }
        }
        i++;
        i=i%n1;
    }for(int j=0;j<n1;j++){
        if(a[j]>0){
            cout<<j+1;
            break;
        }
    }
}

/**
 *  winners never quit
**/
#include <bits/stdc++.h>
using namespace std;
#define newline '\n'
#define space ' '
#define PQ priority_queue
#define VE vector
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(X) X.begin(), X.end()
#define II int, int
#define IS int, string
#define SI string, int
#define SS string, string
#define set_fraction(pnt) cout << fixed << setprecision(pnt);
#define faster() {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
const double pi = acos(-1.0);

const int N = 10000;

int main()
{
  faster()
  int t, ca = 0;
  int n, m, el;
  cin >> n >> m;
  VE <pair <II> > v;
  for (int i = 0;i < n;i++){
    cin >> el;
    v.pb(mp(ceil(double(el)/m), i+1));
  }
//  for (int i = 0;i < n;i++){
//    for (int j = 0;j < n-i-1;j++){
//      if (v[j].first > v[j+1].first){
//        swap(v[j].first, v[j+1].first);
//        swap(v[j].second, v[j+1].second);
//      }
//    }
//  }
  sort(all(v));
  cout << v[n-1].second << newline;
  return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
	int n, m, a[105], idx=-1, ma=-1;
	scanf("%d%d", &n, &m);
	for(int i=0; i<n; i++) scanf("%d", &a[i]), a[i]=ceil((double)a[i]/m);
	for(int i=n-1; i>=0; i--) if(a[i]>ma) ma=a[i], idx=i;
	printf("%d", idx+1);
	return 0;
}

#include <iostream>
using namespace std;
#include <vector>
#include <queue>
struct child
{
	int number ;
	int candy;
};
int main()

{

	vector <int> data(103,0);

	//freopen("in.txt","rt",stdin);
	//freopen("out.txt","wt",stdout);
	/////////////// get problem data ;
	int c ;
	int i =0;
	while(cin>>c && c != 333)
	{
		if(c!=333)
		data[i] = c ;
		i++;
	}

	//////////////////////
	int m = data[1];
	int n = data[0] ;
	data.erase(data.begin());
	data.erase(data.begin());
	vector < child > childs(n+1);

	for(int i = 0 ; i< n ; i++)
	{
		childs[i].candy = 0 ;
		childs[i].number = i ;
	}
	childs.resize(n);
	child temp ;
	while(childs.size() > 1)
	{
		childs[0].candy += m ;

		if(childs[0].candy >= data[childs[0].number])
		{
			childs.erase(childs.begin());

		}
		else
		{

			temp = childs[0];
			childs.erase(childs.begin());
			childs.push_back(temp);
		}

	}

	cout<<childs[0].number + 1 <<endl;

	//system("pause");

return 0 ;
}

// ConsoleApplication186.cpp : Defines the entry point for the console application.
//
#include <iomanip>
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <vector>
#include<set>
#include<map>
#include <time.h>
#include <fstream>
#include <queue>
using namespace std;
int main(){

	queue<int> q;
	int n, m;
	cin >> n >> m;
	int a[102];
	for (int i = 0; i < n; i++){
		cin >> a[i];

		q.push(i);

	}

	int x;

	while (!q.empty()){

		 x = q.front();
		 q.pop();

		 if (a[x] > m){
			 q.push(x);
			 a[x] -= m;
		 }
	}
	cout << x+1;

}

#include<iostream>
#include<cmath>

using namespace std;
typedef long long inta;

int main()
{
     int n,m,last;
     double r=0;
     cin>>n>>m;
     int a[n];
     for(int i=0;i<n;i++)
     {
         cin>>a[i];
        if(r <= ceil((double)a[i]/m) )
        {
            r = ceil((double)a[i]/m);
            last = i;
        }
     }
     cout<<last+1;
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
     int n, m;
     cin>>n>>m;
     int arr[n];
     for(int i=0;i<n;i++)
       cin>>arr[i];
     int ans = ceil((double)arr[0]/m), last =0;
     for(int i=1;i<n;i++)
      {
           if(ceil((double)arr[i]/m)>=ans)
              {
                   ans = ceil((double)arr[i]/m);
                   last = i;
              }
              //cout<<ans<<" ";
      }
     cout<<last+1;
}

#include <bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;

int read()
{
	int num=0;
	int flg=1;
	char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
		{
			flg=-1;
		}
		c=getchar();
	}
	while(isdigit(c))
	{
		num=(num<<1)+(num<<3)+(c^48);
		c=getchar();
	}
	return num*flg;
}

int main()
{
	int n=read();
	int m=read();
	int cur=0;
	int res=0;
	for(ri i=1;i<=n;i++)
	{
		int need=read();
		int tmp=(need/m)+((need%m)>0);
		if(tmp>=cur)
		{
			cur=tmp;
			res=i;
		}
	}
	return 0&printf("%d",res);
}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n,k; cin>>n>>k;
	int maxi = 0;
	vector<int> c(n);
	for(int i = 0; i < n;i++)
	{
			cin>>c[i];
	}

	for(int i = 1; i < n;i++)
	{
		if(((c[i]-1)/k)>=(c[maxi]-1)/k) maxi = i;
	}
	maxi++;
	cout<<maxi;
}

#include <iostream>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;
 int x[51][51];
 int main()
 {
	 int n,m,a,mx=0,R;int x[100];
	 cin>>n>>m;
	 for(int i=0 ; i<n ; i++)
	 {
		 cin>>a;
		 if(a<m) x[i]=1;
		 else { x[i]=a/m; if(a%m) x[i]++; }
	 }
	 for(int i=0 ; i<n ; i++)
		 if(x[i]>=mx)  mx=x[i],R=i+1;
	 cout<<R;
     return 0;
 }

#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,m,index;
   cin>>n>>m;
   vector<pair<int,int >>v(n);
   for(int i=0;i<n;i++)
   {
       cin>>v[i].first;
       v[i].second=i;
   }
   int max=v[0].first;
  for(int i=0;i<n;i++)
  {
      if(max<v[i].first)
      {
          max=v[i].first;
          index=i;
      }
  }
   int k;
   k=max/m;
  // cout<<max<<k;

  if(max==m)
  {
      cout<<n;
      return 0;
  }

     if(k==1)
     {
        for(int i=0;i<n;i++)
         v[i].first=v[i].first-m;
     }
     else if(max%m==0)
     {
           for(int i=0;i<n;i++)
           v[i].first=v[i].first-(k-1)*m;
     }
     else if(max%m!=0)
     {
         for(int i=0;i<n;i++)
         v[i].first=v[i].first-(k)*m;
     }
     for(int i=n-1;i>=0;i--)
     if( v[i].first>0)

     {
         cout<<i+1;
         break;
     }

}

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
    int n, m, a[105], idx=-1, ma=-1;
    scanf("%d%d", &n, &m);

    for(int i=0; i<n; i++) scanf("%d", &a[i]), a[i]=ceil((double)a[i]/m);

    for(int i=n-1; i>=0; i--) if(a[i]>ma) ma=a[i], idx=i;

    printf("%d\n", idx+1);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,x,y=0,j;
    cin>>n>>m;
    double a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        j=ceil(a[i]/m);
        if(j>=y)
        {
            y=j;
            x=i;
        }
    }
    cout<<x<<endl;
    return 0;
}

// AUTHOR: AMAN JAIN
#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define LLU unsigned long long
#define PI acos(-1)
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define sieve(a) ({int b=ceil(sqrt(a));VI d(a,0);VI e;int f=2;e.pb(2);e.pb(3);for(int x=1;x<b+1;x++){for(int y=1;y<b+1;y++){int n=(4*x*x)+(y*y);if(n<=a&&(n%12==1||n%12==5)){d[n]^=1;}n=(3*x*x)+(y*y);if(n<=a&&n%12==7){d[n]^=1;}n=(3*x*x)-(y*y);if(x>y&&n<=a&&n%12==11){d[n]^=1;}}}for(int r=5;r<b+1;r++){if(d[r]){for(int i=r*r;i<a;i+=(r*r)){d[i]=0;}}}for(int c=5;c<a;c++){if(d[c]){e.pb(c);}}e;})
#define INF 1000000007
#define EPS 1e-9
#define setbits(x) __builtin_popcount(x) //tell number of 1's in binary form
#define GC getchar_unlocked
#define asd(x)              cout<<__LINE__<<" :: "<<#x<< ": "<<x<<endl;
#define asdf(x, y)          cout<<__LINE__<<" :: "<<#x<< ": "<<x<<" | "<<#y<< ": "<<y<<endl;
template<class T>inline T modinv(T a,T n){T i=n,v=0,d=1;while(a>0){T t=i/a,x=a;a=i%x;i=x;x=d;d=v-t*x;v=x;}return (v+n)%n;}
LL modpow(LL n ,LL k,LL mod){LL ans=1;while(k>0){if(k&1)ans=(ans*n)%mod;k>>=1;n=(n*n)%mod;}return ans%mod;}
//template<class T>inline void output(T a){if(a){T v=a%10;output(a/10);putchar((char)(v+'0'));}}
//template<class T>inline T input(T x){char c=GC();x=0;T s=1;while(c<48||c>57){if(c=='-')s=-1;c=GC();}while(c>=48&&c<=57){x=(x<<3)+(x<<1)+c-48;c=GC();}return x*s;}

template <class T> string str(T Number){
	string Result;          // string which will contain the result
	ostringstream convert;   // stream used for the conversion
	convert << Number;      // insert the textual representation of 'Number' in the characters in the stream
	Result = convert.str();
	return Result;
}
int StringToNumber ( const string &Text )
{
	istringstream ss(Text);
	int result;
	return ss >> result ? result : 0;
}
template<class T> inline vector<pair<T,int> > FACTORISE(T n){vector<pair<T,int> >R;for (T i=2;n>1;){if (n%i==0){int C=0;for (;n%i==0;C++,n/=i);R.push_back(make_pair(i,C));}i++;if (i>n/i) i=n;}if (n>1) R.push_back(make_pair(n,1));return R;}
template<class T> inline T TOTIENT(T n) {vector<pair<T,int> > R=FACTORISE(n);T r=n;for (int i=0;i<R.size();i++)r=r/R[i].first*(R[i].first-1);return r;}
template<class T>inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
int main(){
	int n,m;
	cin>>n>>m;
	int a[n];
	int po=-1,maxi=0;
	int x;
	for(int i=0;i<n;++i){
		cin>>x;
		// cout<<(x+2)/3
		if(((x+m-1)/m)>=maxi){
			maxi=(x+m-1)/m;
			po=i;

		}
	}
	cout<<po+1;
	return 0;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
void solve(){
    int n,m;
    cin>>n>>m;
    int a[n];
    int ma=0,k;
    int x;
    for(int i=0;i<n;i++){
        cin>>x;
    a[i]=x/m;
    if(x%m!=0 && x>m )
    a[i]++;
    if(x==m)
    a[i]--;
    if(a[i]>=ma){
    k=i;
    ma=a[i];
    }
    }
    cout<<k+1<<endl;
    }
int main() {
   long long int t=1;
 // cin>>t;
    while(t--){
      solve();
    }
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <clocale>
#include <bitset>
#include <memory.h>

using namespace std;

#pragma comment (linker, "/STACK:667177216")
#define ll long long
#define LL long long
#define ull unsigned long long
#define sc(a) scanf("%d",&a)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mp make_pair
#define pb push_back
const ll mod = 1000000009;
#define INF (int)(2e9 + 1e8)
#define LINF (ll)(4e18)
#define forn(i,n) for(int (i) = 0;(i)<n;i++)
#define forit(mas) for(auto(it)=(mas).begin();(it)!=(mas).end();(it)++)

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m;
	cin >> n >> m;
	int mx = 0, idx = 0;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		if ((a - 1) / m + 1 >= mx) {
			mx = (a - 1) / m + 1;
			idx = i;
		}
	}
	cout << idx << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{long n,m,i,x,r=0,maxa=0,j=0;
    vector<long > q;
    cin>>n>>m;q.resize(n);
    for(i=0;i<n;i++){
        cin>>q[i];
      while((q[i]-=m)>0){
        r++;
      }
      if(r>=maxa){maxa=r;j=i;}
      r=0;
    }
   cout<<j+1;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n,m;
	cin>>n>>m;
	int arr[100];
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i];
	}
	for (int i = 0; i < n; ++i){
		arr[i] = ceil(1.0 * arr[i]/m);
	}
	int k = 0;
	for (int i = 0; i <n ; ++i)
	{
		if (arr[i]>=arr[k]){
			k = i;
		}
	}
	cout<<k+1;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin>>n>>m;
    double a[n];
    vector <int> b;
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]=ceil(a[i]/m);
    }
    int c=(*max_element(a,a+n));
    for(int i=0;i<n;i++){
        if(a[i]==c)
        b.push_back(i+1);
    }
    cout<<*max_element(b.begin(),b.end());
}

#include <cstdio>
#include <iostream>
#include <iostream>
using namespace std;
int a[500];
int v[500];
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("date.in","r",stdin);
        freopen("date.out","w",stdout);
    #endif // ONLINE_JUDGE
    cin.sync_with_stdio(false);
    int n,poz=0,m,i;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int ok=n;
    while(ok>0)
    {
        for(i=1;i<=n;i++)
            if(a[i]>0)
            {
                a[i]=a[i]-m;
                if(a[i]<=0)
                {
                    ok--;
                    if(ok==0)
                        poz=i;
                }
            }
    }
    cout<<poz;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <string>
#include <cstring>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i ++)
#define mem(s, v) memset(s, v, sizeof(s))
#define sz(v) (int)v.size()
#define pb push_back
#define mp make_pair

int main() {
    int n, m;
    cin >> n >> m;

    int a[n];
    rep(i, n) cin >> a[i];

    rep(i, n) a[i] = (a[i] - 1) / m;

    int res = 1;
    int num = a[0];

    rep(i, n) {
        if (a[i] >= num) {
            res = i + 1;
            num = a[i];
        }
    }

    cout << res;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
queue<pii> q;
int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i = 1;i <= n;i ++ ) {
		int x;
		scanf("%d",&x);
		q.push(make_pair(x,i));
	}
	while (!q.empty()) {
		int x = q.front().first - m;
		int id = q.front().second;
		q.pop();
		if (q.empty()) {
			printf("%d",id);
			return 0;
		}
		if (x > 0) {
			q.push(make_pair(x,id));
		}
	}
	return 0;
}

#include <iostream>
#include <iomanip>
#include <cctype>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <iterator>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <stack>
#include <fstream>
#include <bitset>

using namespace std;

int main()
{
    int n,m,ans=0;
    cin >> n>>m;
    string s;
    vector<int> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
        v[i] = (v[i] + m - 1) / m;
    }
    for (int i = 0; i < n; i++){
        if (v[ans] <= v[i]){
            ans = i;
        }
    }
    cout << ans+1;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        arr[i] = (arr[i]+m-1)/m;
    }
    int max = arr[0],index=0;
    for(int i=0;i<n;i++)
    {
        if(arr[i]>=max)
        {
            max = arr[i];
            index = i;
        }
    }
    cout<<index+1;
    return 0;
}

#include <vector>
#include <iostream>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <bitset>
#include <limits>

#define ll long long
#define lli long long int

using namespace std;

#define MAX 1000000007

int main()
{
  int n,m;
  scanf("%d %d",&n,&m);
  vector<float> a(n,-1);
  int max = -1;
  int ind = -1;
  int flag =0 ;
  for(int i=0;i<n;i++) {
    scanf("%f",&a[i]);
    if(max<=ceil(a[i]/m)) {
      max = ceil(a[i]/m);
      ind = i;
      //printf("%d \t ind = %d \t",max,ind);
    }
  }
  printf("%d\n",ind+1);
  return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int n, m;
	int a[100];
	int ans=0;
	int i=0;
	cin>>n;
	cin>>m;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		a[i]--;
		a[i]/=m;
		if(a[i]>=a[ans])
			ans=i;
	}
	ans++;
	cout<<ans;
}

#include<stdio.h>
int *a;
int main(){
int n, m, mx = 0, t;
 scanf("%d %d",&n, &m);
 a = new int [n];
 for(int i = 0; i < n; i ++){
    scanf("%d",a + i);
 a[i] = (a[i] + m - 1)/m;
 if(mx <= a[i]){
    mx = a[i];
    t = i + 1;
 }
 }
 printf("%d",t);
  return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<numeric>
#include<iomanip>
#include<bitset>
#include<sstream>
#include<fstream>
#define debug puts("-----")
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf (1<<30)
using namespace std;
struct node
{
    int i,x;
};
int main()
{
    int n,m;
    queue<node> q;
    cin>>n>>m;
    for (int i=1; i<=n; i++)
    {
        int x;
        cin>>x;
        node a;
        a.i=i;
        a.x=x;
        q.push(a);
    }
    node a;
     while(!q.empty())
    {
        a=q.front();
        q.pop();
        a.x-=m;
        if (a.x>0)
            q.push(a);
    }

    cout<<a.i<<endl;
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
    int n, m, x;
    cin >> n >> m;
    vector <int> arr(n);
    for(int i = 0; i < n  &&  cin >> x; i++)
      arr[i] = x;

    for (int i = 0; i < n; i++)
        arr[i] = (arr[i] -1) / m + 1;
    int max = 0;
    int index = -1;
    for (int i = 0; i < n; i++)
        if (max <= arr[i])
        {
            max = arr[i];
            index = i;
        }

    cout << index + 1;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()

{
    int t,x,big=0,bro=0;
    long double z;
    cin>>t>>x;
    long double arr[t];
    for(int i=0; i<t; i++)
    {
        cin>>z;
        z=z/x;
        int one=z;
        if(one!=z)
            one++;
        arr[i]=one;
    }
    for(int i=0; i<t; i++)
    {
        if(arr[i]>=big)
        {
            big=arr[i];
            bro=i+1;
        }
    }
    cout<<bro;
    return 0;
}

#include <iostream>
using namespace std;
int n, m, a[100001], maxi, in;
int main () {
	cin >> n >> m;
	cin >> a[0];
	maxi = a[0];
	for(int i = 1; i < n; i++)
	{
		cin >> a[i];
		if((a[i] + m - 1) / m >= (maxi + m - 1) / m)
		{
			maxi = a[i];
			in = i;
		}
	}
	cout << in + 1;

	return 0;
}

#include <bits/stdc++.h>
#define ULL                 unsigned long long
#define LL                  long long
#define LD                  long double
#define PI                  3.14159265359
#define ahmed_elmotaz       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// for(int i=0;i<t;i++){}
using namespace std;

int main()
{
    ahmed_elmotaz
    int t,z,ans1=0,ans=0;
    cin>>t>>z;
    LL s[t];
    for(int i=0;i<t;i++){
        int k,add=0;
        cin>>k;
        add=k;
        k=k/z;
        s[i]=k;
        if(add%z!=0){
            s[i]++;
        }
    }
    for(int i=0;i<t;i++){
        if(s[i]>=ans1){
            ans1=s[i];
            ans=i+1;
        }
    }
    cout<<ans;
    return 0;
}
/*
a=97  A=65
z=122 Z=90
0=48
prime number of ones in their binary representation

*/

#include<iostream>
using namespace std;
int main(){
    int a,b,c,w=0,s;
	cin>>a>>b;
	for(int i=1; i<a+1; i++){
		cin>>c;
		c=c+b-1;
		if(c/b>=w)
			w=c/b,s=i;
    }
    cout<<s;
    return 0;
}

#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iostream>
struct acm{int id;int sum;}t[20005];
int i,j,n,m,k,l,o,p,ans,head,tail,a[105];
int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		t[i].id=i;tail++;
	}
	while (head<tail)
	{
		head++;
		if (head==tail)
		{
			ans=t[head].id;break;
		}
		if (t[head].sum+m<a[t[head].id]) t[++tail].id=t[head].id,t[tail].sum=t[head].sum+m;
	}
	printf("%d",ans);
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int n, m, a, res, mx;
	cin>>n>>m;
	res = mx = a = 0;
	vector<int> v(n ,0), p(n, 0);
	for(int i = 0; i < n; ++i){
		cin>>a;
		v[i] = a;
		p[i] = a;
	}
	for(int i = 0; i < n; ++i){
		int r = v[i] % m;
		v[i] /= m;
		if(r > 0)v[i]++;

	}
	res = 0;
	int best = 0;
	for(int i = 0; i < n; ++i){
		if(v[i] >= mx){
			res = i;
			mx = v[i];
		}
	}
	cout<<res + 1<<endl;
	return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int m, n,x[200];
	cin >> n >> m;
	int i;
	for (i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	bool f = 0;
	for (i = 0; i < n; i++)
	{
		if (x[i] > m)
		{
			f = 1;
		}
	}
	if (f == 0)
	{
		cout << n << endl;
	}
	else
	{
		int max = 0;
		for (i = 0; i < n; i++)
		{
			if (x[i] > max)
			{
				max = x[i];
			}
		}
		int a, b, c;
		if (max%m == 0)
		{
			a = max / m;
			c = a*m;
			b = (a -1 )*m;
		}
		else
		{
			a = max / m;
			b = a*m;
			c = (a + 1)*m;
		}

		for (i = n-1; i >=0; i--)
		{
			if (x[i]>b && x[i]<=c)
			{
				cout << i + 1 << endl;
				return 0;
			}
		}
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define orr ||
#define int long long
#define pb push_back
#define usi unordered_set<int>
#define umii unordered_map<int,int>
#define mp make_pair
#define pl pair<int,int>
#define vl vector<int>
#define endl ("\n")
#define pi (3.141592653589)
#define rloop(n) for(int i=n-1;i>=0;i--)
#define loop(i,k,n) for(int i=k;i<n;i++)

void fastio()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	cout<<fixed<<setprecision(10);
}
int32_t main(){
    fastio();
int n,m;
cin>>n>>m;
int arr[n];
loop(i,0,n)cin>>arr[i];
int mx=0;
int ans;
loop(i,0,n){
    if((arr[i]-1+m)/m>=mx){
        mx=(arr[i]-1+m)/m;
        ans=i;
    }
}
cout<<ans+1;
return 0;
}

#include<iostream>
#include<queue>
using namespace std;
struct Node{
	int id;
	int a;
}t;
int n,m,a;
queue<Node>q;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>t.a;
		t.id=i;
		q.push(t);
	}
	int f=1;
	while(!q.empty()){
		t=q.front();
		q.pop();
		if(t.a>m){
			t.a-=m;
			q.push(t);
		}
		f=t.id;
	}
	cout<<f;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,arr[1010],temp=0,ans;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(temp<=ceil((double)arr[i]/m))
        {
            temp=ceil((double)arr[i]/m);
            ans=i;
        }
    }
    cout<<ans+1;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define F(i,n) for(int i=0;i<n;i++)
#define G(i,m,n) for(int i=m;i<=n;i++)
int main()
{

ll t,m,p,k,mx=0;
cin >> t;
cin >> m;
ll arr[t];
F(i,t)
{
    cin >> arr[i];
}

F(i,t)
{
  if(arr[i]%m==0)
  {
      if( ((arr[i] / m )-1)>=mx)
      {
          mx=arr[i]/m - 1;
          k=i;
      }
  }
  else{

     if( ((arr[i])/m )>=mx)
      {
          mx=arr[i]/m;
          k=i;
      }

  }
}

cout << k+1;

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,a[10000],max=-1,index=0,b[10000];
    cin>>n>>m;
    for( int i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=ceil(1.0*a[i]/m);
       // cout<<b[i];

    }
    for(int i=0;i<n;i++)
    {
        if(b[i]>=max)
         {
             max=b[i];
             index=i;
         }
    }

    cout<<index+1<<"\n";

    return 0;
}

#include<iostream>
using namespace std;

int n,m=-1,a,p,mxi;

int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		if((a-1)/m >= mxi)
		{
			p=i;
			mxi=(a-1)/m;
		}
	}
	cout<<p;
	return 0;
}

#include<iostream>
#include<cstdio>

using namespace std;

int main() {
	int n,m,temp,max=-1,max_i=-1;
	int arr[100];
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) {
		scanf("%d",&temp);
		if(temp%m==0) {
			arr[i]=(temp/m)-1;
		} else {
			arr[i]=temp/m;
		}
		if(arr[i]>=max) {
			max=arr[i];
			max_i=i+1;
		}
	}
	printf("%d\n",max_i);
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iterator>
#include <sstream>
#define pb push_back
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vin vector<double>
#define vs vector<string>
#define sti set<int>
#define stc set<char>
#define stll set<long long>
#define its stll::iterator
#define itsc stc::iterator
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ll long long
#define in insert

using namespace std;

string toString (long long n) { stringstream ss; ss<<n; return ss.str(); }
long long toNumber(string s) { stringstream ss; long long n; ss<<s; ss>>n; return n; }

int main(){
    double n,m;
    cin>>n>>m;
    vin v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++){
        v[i]=ceil(v[i]/m);
    }
    double max=0;
    int index;
    for(int i=0;i<n;i++){
        if(v[i]>=max){
            max=v[i];
            index=i+1;
        }
    }
    cout<<index;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << "=" << x << endl
#define li(i, n) for (ll i = 0; i < n; i++)
#define ld(i, k, n) for (ll i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define yo cout << "yo" << endl;
#define lc(i, v) for (auto i : v)
#define lv(type, name, it) for (vector<type>::iterator it = name.begin(); it < name.end(); it++)
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mod 1000000007
#define el "\n"
#define rs(vec, size) vec.reserve(size)
#define rr(c) c.begin(), c.end()
#define F first
#define S second
#define pp(a) cout << fixed << setprecision(a);
typedef long long ll;
typedef vector<ll> vi;
vi invi(ll n)
{
    int x;
    vi a;
    li(i, n)
    {
        cin >> x;
        a.pb(x);
    }
    return a;
}

void solve();
int main()
{
#ifndef ONLINE_JUDGE
    freopen(".input.txt", "r", stdin);
    freopen(".output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //  cin >> t;
    while (t--)
        solve();
}
void solve()
{
    ll n, m;
    cin >> n >> m;
    //check t
    vi stdlst = invi(n);
    ll count = 0, last;

    while (1)
    {
        lv(ll, stdlst, it)
        {
            if (*it > 0)
            {   last = it - stdlst.begin() + 1;
                *it -= m;
            }else
                continue;
            //  db(*it);
            if (*it < 1)
            {   // db(*it);
                // ls.insert(*it);
                count++;
            }

            if (count == n)
                break;
        }
        // lc(e, stdlst) db(e);
        // db(count);
       // cout << el;
        if (count == n)
            break;
    }
    // lc(e, stdlst) db(e);
    // li(i, n)
    // {
    //     if (stdlst[i] > 0)
    //         cout << i + 1 << el;
    // }
     cout<<last<<el;
}

#include <iostream>
using namespace std;
main()
{
      int n,m;
      cin>>n>>m;
      int i,a[n],br[n],max=0,pomi;

      for(i=0;i<n;i++)
      {
      cin>>a[i];
      }
      if(n==1)
      {
      cout<<1;
      cin.get();
      cin.get();
      return 0;
      }
      for(i=n-1;i>=0;i--)
      {
      br[i]=a[i]/m;
      if(a[i]>0)
      {
      if(a[i]%m!=0)
      {
      br[i]++;
      }
      }
      if(br[i]>max)
      {
      max=br[i];
      pomi=i;
      }
      }
      cout<<pomi+1;
      cin.get();
      cin.get();
}

#include <iostream>

using namespace std;

int main() {
    int nr, m, n, poz = 0, maxx = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> nr;
        if ((nr - 1) / m == maxx) poz = i;
        else if ((nr - 1) / m > maxx) {
            maxx = (nr - 1) / m;
            poz = i;
        }
    }
    cout << poz;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <deque>
#include <queue>
#include <climits>
#define ll long long
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define inll(n) scanf("%I64", &n);
#define outll(n) printf("%I64", n);
#define in(n) scanf("%d", &n);
#define out(n) printf("%d", n);
#define F first
#define S second
#define vii vector < int >
#define vsi vector < string >
#define vchi vector < char >
#define vlli vector < ll >

using namespace std;

const int MAXN = int (1e5) + 256;
int n, m, a, mx, j;

int main () {
    #ifdef accepted
    	READ ("input.txt");
    	WRITE ("output.txt");
    #endif

	cin >> n >> m;

	for (int i = 0; i < n; ++i) {
		cin >> a;
		int xD = (a + m - 1) / m;
		if (xD >= mx) {
			mx = xD;
			j = i + 1;
		}
	}
	cout << j;

    exit (0);
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{
	int a[1001],n,m,i,j,k;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		for(i=0;i<n;++i)
		{
			scanf("%d",&a[i]);
			if(a[i]%m==0)
				a[i]/=m;
			else
				a[i]=a[i]/m+1;
		}
		k=0;
		int max=a[0];
		for(i=1;i<n;++i)
		{
			if(max<=a[i])
			{
				max=a[i];
				k=i;
			}
		}
		printf("%d\n",k+1);
	}

}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define N 2000005

int main() {
    ll t=1;
    // cin>>t;
    while(t--) {
        ll n,m,i;
        cin>>n>>m;
        ll a[n];
        for(i=0;i<n;i++) {
            cin>>a[i];
        }
        ll nochange=0,last=0;
        do {
            nochange=0;
            for(i=0;i<n;i++) {
                if(a[i]>0) {
                    last = i+1;
                    a[i]-=m;
                    nochange++;
                }
            }
        }while(nochange!=0);
        cout<<last<<"\n";
    }
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{

        int m,i,n,max= 0,ind=0;
        cin >> n >> m;
        vector<int> v(n);
        for(i = 0; i < n; i++)
        {
                cin >> v[i];
                v[i] = ceil(double(v[i])/m);
                if(v[i] >= max)
                {
                        max = v[i];
                        ind = i;
                }
        }
        cout << ind+1;

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{

        ll n, i, j, m, c = 0, sum = 0;

        int mx = 0, mn = 0, lz=0, rz=0, lo=0, ro=0;

        cin >> n >> m;
        vector<int> v(n);
        for(i = 0; i < n; i++)
        {
                int a;
                cin >> a;
                if(a % m == 0)
                        v[i] = a/m ;
                else
                        v[i] = a/m + 1;

                if(v[i] > mx)
                        mx = v[i] ;
        }
        for(i = n; i >= 0; i--)
        {
                if(v[i] == mx)
                {
                        cout << i + 1;
                        break;
                }
        }

 }

/*
URL_HERE
*/
/*

*/
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <math.h>

using namespace std;

FILE* _fin = stdin;
FILE* _fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var,n) for(int var=0;var<n;++var)
#define repi(n) rep(i,n)
#define repj(n) rep(j,n)
#define repi1(n) for(int i=1;i<n;++i)
#define repj1(n) for(int j=1;j<n;++j)
int _min(int a, int b) { return a <= b ? a : b; }
int _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
int _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int* data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll* data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(char* data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() { char var; fscanf(_fin, "%c", &var); return var; }
int readi() { int var; fscanf(_fin, "%d", &var); return var; }
double readlf() { double var; fscanf(_fin, "%lf", &var); return var; }
ll readll() { ll var; fscanf(_fin, "%lld", &var); return var; }
void repread(int* data, int n) { repi(n) data[i] = readi(); }
void repread(ll* data, int n) { repi(n) data[i] = readll(); }
int reads(char* str, int maxsize)
{
	for (;;) { if (fgets(str, maxsize, _fin) == NULL) break; if (str[0] != '\n' && str[0] != '\r') break; }
	int slen = strlen(str); if (slen == 0) return 0;
	if (str[slen - 1] == '\n' || str[slen - 1] == '\r') str[--slen] = 0;
	return slen;
}

#define writec(var) fprintf(_fout,"%c",var)
#define writecsp(var) fprintf(_fout,"%c ",var)
#define writecln(var) fprintf(_fout,"%c\n",var)
#define writei(var) fprintf(_fout,"%d",var)
#define writeisp(var) fprintf(_fout,"%d ",var)
#define writellsp(var) fprintf(_fout,"%lld ",var)
#define writeiln(var) fprintf(_fout,"%d\n",var)
#define writellln(var) fprintf(_fout,"%lld\n",var)
#define writeulln(var) fprintf(_fout,"%llu\n",var)
#define writefln(var) fprintf(_fout,"%f\n",var)
#define writes(str) fprintf(_fout,"%s",str)
#define writesp() fprintf(_fout," ")
#define writeln() fprintf(_fout,"\n")
#define RUN_LOCAL(testfilename) {_fin = fopen(testfilename, "r"); if(_fin==NULL) _fin=stdin;}
#define swap(type,a, b) {type t=a;a=b;b=t;}
#define sort(data,n) std::sort(data,data+n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell is this...
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return (a / g) * b; }
void reverse(char* data, int n) { int k = n >> 1; repi(k) { char tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(int* data, int n) { int k = n >> 1; repi(k) { int tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }

#define _Vec(type, name) \
struct name { type* data; int size; int n; };\
void init(name* t, int size) { t->data = (type*)malloc(sizeof(type) * size); t->size = size; t->n = 0; }\
void resize(name* t) { int ns = t->size * 1.2f; t->data = (type*)realloc(t->data, sizeof(type) * ns); t->size = ns; }\
void add(name* t, type val) { if (t->n >= t->size) resize(t); int k = t->n; t->data[k] = val; t->n = k + 1; }\
void free(name* t) { free(t->data);}
_Vec(int, Veci)
_Vec(long long, Vecll)
_Vec(char*, Vecs)

#define _ispal(type, name) int name(type* a, type* b, int n){repi(n){if (a[i] != b[n - i - 1]){return 0;}}return 1;}
_ispal(int, ispali)
_ispal(char, ispalc)

#define _Pair(type, name) struct name{type x, y;}; \
int cmp_##name(const void* _a, const void* _b)\
{\
	name* a = (name*)_a;name* b = (name*)_b;\
	if (a->x < b->x) return -1;\
	else\
	{\
		if (a->x == b->x)\
		{\
			if (a->y == b->y) return 0;\
			if (a->y < b->y) return -1;\
			else return 1;\
		}\
		else\
		{\
			return 1;\
		}\
	}\
}\
void sort_##name(name* d, int n){qsort(d, n, sizeof(name), cmp_##name);}
	_Pair(int, Pairi)

	int cmp_Str(const void* _a, const void* _b) { char* a = *((char**)_a); char* b = *((char**)_b); return strcmp(a, b); }
void sort_Str(char** str, int n) { qsort(str, n, sizeof(char*), cmp_Str); }

ll expmod(ll x, ll n, ll m) {
	ll ans = 1;
	for (; n;) {
		if (n & 1) ans = (ans * x) % m;
		x = (x * x) % m;
		n >>= 1;
	}
	return ans;
}

ll combmod(ll n, ll k, ll m) {
	ll ret = 1;
	ll div = 1;
	for (ll i = 0; i < k; ++i) {
		ret = (ret * (n - i) % m) % m;
		div = (div * (i + 1)) % m;
	}
	div = expmod(div, m - 2, m) % m;
	return (ret * div) % m;
}

int next_perm(int* data, int n)
{
	//find first i,i+1 where d[i]<d[i+1]
	int rootidx = -1;
	for (int i = n - 2; i >= 0; --i)
	{
		if (data[i] < data[i + 1])
		{
			rootidx = i;
			break;
		}
	}

	if (rootidx == -1) return 0;

	int ceilingidx = rootidx + 1;
	//find smallest d[x] after d[rooti] where d[x]>d[rooti]
	for (int i = rootidx + 2; i < n; ++i)
	{
		if (data[i] > data[rootidx] && data[i] < data[ceilingidx])
		{
			ceilingidx = i;
		}
	}

	swap(int, data[rootidx], data[ceilingidx]);
	sort(&data[rootidx + 1], n - rootidx - 1);
	return 1;
}
int count_digits(ll a)
{
	int k = 0;
	for (;;)
	{
		if (a == 0)break;
		k++;
		a /= 10;
	}
	return k;
}

/*
use only when val EXISTS in data
*/
int bs_exists(int* data, int n, int val)
{
	int left = 0;
	int right = n - 1;
	for (; left < right;)
	{
		int mid = (left + right + 1) >> 1;
		if (data[mid] <= val) left = mid;
		else right = mid - 1;
	}
	return right;
}
//------------------------------------------

//------------

int main()
{
	RUN_LOCAL("xx11.txt");
	int n = readi();
	int m = readi();
	static int a[100];
	repread(a, n);
	repi(n)
	{
		a[i] = a[i] / m + (a[i]%m?1:0);
	}

	int mxidx = 0;
	repi1(n)
	{
		if (a[i] >= a[mxidx])
		{
			mxidx = i;
		}
	}
	writeiln(mxidx + 1);
	return 0;
}

#include<iostream>
#include<deque>
using namespace std;
int main(){
    int n,m,a[100];
    deque<int>g;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        g.push_back(i);
    }
    if(n==1){
        cout<<1;
        exit(0);
    }
    while(!g.empty()){
        if(a[g.front()]-m>0){
            g.push_back(g.front());
            a[g.front()]=a[g.front()]-m;
            g.pop_front();
        }
        else if(a[g.front()]-m<=0){
            g.pop_front();
        }
        if(g.size()==1){
            cout<<g.front();
            exit(0);
        }
    }
    return 0;
}

#include<iostream>
#include<vector>
using namespace std;
int main() {
	vector<int>children;
	int n, m,sum=0;
	int last=-1;
	cin >> n>> m;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		children.push_back(x);
	}
	for (int i = 0; i < n; i++){
		if (children[i] > 0) {
			last = i;
			sum += (children[i]);
			children[i] -= m;
		}
		if (i == n - 1) {
			if (sum > 0) {
				sum = 0;
				i = -1;
			}
		}
	}
	cout << last+1 << endl;
}

#include <bits/stdc++.h>

using namespace std;

int n, a[105], s, s1, mxi, mx=-9999;
//pair <int, int> x[100000005];
double m;

int main()
{
    cin >> n >> m;
    for (int i=1;i<=n;i++)
    {
        cin >> a[i];
        if (mx<=ceil(a[i]/m))
        {
            mx=ceil(a[i]/m);
            mxi=i;
        }
    }
    cout << mxi;
}

#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <functional>
#include <stack>
#include <chrono>
#include <ctime>
#include <cstdio>
#include<set>
#include<algorithm>
#include<cassert>
#include<iomanip>
using namespace std;
bool check(int a, int b) {
	return pow(a, 2) + b == pow(b, 2) + b;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m, ans;
	cin >> n >> m;
	deque <int> x(n);
	int t;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	bool flag = 1;
	while (flag) {
		flag = 0;
		for (int i = 0; i < x.size(); i++) {
			if (x[i] > 0) {
				flag = false;
				x[i] -= m;
				if (x[i] <= 0) {
					ans = i + 1;
				}
				flag = true;
			}

		}

	}
	cout << ans;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,p=0,f=0;
double t;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>t;
if(ceil(t/k)>=p)
{
	p=ceil(t/k);
f=i;
}
}
cout<<f<<endl;

	return 0;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdio>
#include<cmath>
#include<vector>//集合
#include<iomanip>//保留小数
using namespace std;
int main(void)
{
	//cout<<fixed<<setprecision(6)<<a;
	std::ios::sync_with_stdio(false);
	int n,m,a[1000],i,j;
	cin>>n>>m;
	for(i=0;i<n;++i)
	{
		cin>>a[i];
		if(a[i]%m==0)
			a[i]=a[i]/m;
		else a[i]=a[i]/m+1;
	}
	j=n-1;
	for(i=n-1;i>=0;--i)
	{
		if(a[i]>a[j])
			j=i;
	}
	cout<<j+1<<"\n";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
float n,max1=0,m,k,i,a;
cin>>n>>m;
for(i=0;i<n;i++)
{
   cin>>a;
   if(ceil(a/m) >= max1)
   {
       max1=ceil(a/m);
       k=i;
   }
}
cout<<k+1;
return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define pb push_back
typedef long double ld;
typedef vector<ll> vll;
typedef vector<pair<ll,ll>> vpl;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const ll mod = 1e9+7;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll n,m; cin >> n >> m;
        queue<ll> q;
        vll a(n); rep(i,n) cin >> a[i] , q.push(i+1);
        ll ans =-1;
        while(q.size()){
            ll use = q.front(); ans = use; a[use-1] -=m;
            q.pop();
            if(a[use-1]>0) q.push(use);
        }
        cout << ans << endl;
    }
}

#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
int main(){
    int n,m,x,k;
    while(cin>>n>>m){
        int max=-1;
        for(int i=1;i<=n;i++){
            cin>>x;
            if((x-1)/m>=max){
                k=i;
                max=(x-1)/m;
            }
            //cout<<k<<" "<<endl;
        }
        cout<<k<<endl;
    }
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n, m;
	int pos=0, max=-1, pro=0;
	cin>>n>>m;
	int *arr = new int [n];
	for(int i =0 ; i<n ; i++)
	{
		cin>>arr[i];
		if(arr[i]%m==0) pro = arr[i]/m;
		else pro = arr[i]/m+1;
		if(pro>=max) {max=pro; pos=i+1;}
	}
	cout<<pos;
	return 0;
}

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,ans;
    cin>>n>>m;
    vector<int> a(n),temp;
    for(int i=0;i<n;i++)
        cin>>a[i];
    temp=a;
    int i=0;
    while(*max_element(a.begin(),a.end()))
    {
        if(i==n)
            i=0;
        if(a[i]<=m && a[i]!=0)
        {
            a[i]=0;
            ans=i;
        }
        else if(a[i]!=0)
            a[i]-=m;
        i++;

    }
    cout<<ans+1;
	return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
main()
{
    fast;
    ll n,a,temp,li,l;
    cin>>n>>a;
    l=0;
    for(ll i=1;i<=n;i++)
    {
        cin>>temp;
        if(temp % a==0)
			temp /= a;
		else
			temp = temp/a +1;

		if(temp >= l)
		{
		    l=temp;
			li = i;
		}
    }
       cout<<li<<"\n";
    }

/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;

int main()
{

    int n,m,r=0;
    cin>>n>>m;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    pair<int,int>pair1;
    vector<pair<int,int>>fanta;
    for(int i=0;i<n;i++)
    {
        fanta.push_back(make_pair(arr[i],i+1));

    }
    //sort(fanta.begin(),fanta.end());
   // int p=fanta[n-1].first;
    //int q=fanta[n-1].second;
    for(int i=0;i<n;i++)
    {
        if(fanta[i].first==0)
       { break;}
        r=fanta[i].second;
    if(fanta[i].first>m)
    {
        int x=fanta[i].first-m;
        fanta.push_back(make_pair(x,r));
        n++;
    }
    else
    continue;

    }
    cout<<r;

 /*  for(int i=0;i<n;i++)
    {
        cout<<fanta[i].first<<" "<<fanta[i].second<<"\n";
    }*/

   // printf("Hello World");

    return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int comp(const void *p, const void *q)
{
	return (*(int*)q - *(int*)p);
}
int main()
{
	int a, sum = 0, b, i,max,z, c[102], d;
	scanf("%d %d", &a, &b);
	for (i = 1; i <= a; ++i)
	{
		scanf("%d", &d);
		if (d%b)
			c[i] = d / b + 1;
		else
			c[i] = d / b;
	}
	z = 1;
	max = c[1];
	for (i = 1; i <= a; ++i)
	{
		if (c[i] >= max)
		{
			max = c[i];
			z = i;
		}
	}
	printf("%d\n", z);
}

#include <bits/stdc++.h>
using namespace std;

int gcd(int a, int b){
    if(a==0)return b;
    if(b==0)return a;

    if(a==b)return a;

    if(a>b)return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(){

      int n, m;
     cin >> n >> m;
     float kids[n];

     for(int i=0; i<n; i++){
          cin >> kids[i];
     }

     int index;
     float max=0;

     for(int i=0; i<n; i++){
          if(ceil(kids[i] / m) >= max){
               max = kids[i] / m;
               index = i;
          }
     }

     cout << index+1;

     return 0;

}

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int a[101],max=0,j=0,p,k;
        for(int i=1;i<=n;i++)
        {
             scanf("%d",&a[i]);
             if(a[i]>max)
                max=a[i];
        }
        //cout<<max<<endl;
        if(max%m==0)
        {
            p=max/m;
            k=(p-1)*m;
        }
        else if(max%m!=0)
        {
            p=max/m;
            k=(p)*m;
        }
        //cout<<k<<endl;
        for(int i=1;i<=n;i++)
        {
             if(k<a[i])
             {
                 j=i;
              }
        }
        //cout<<j<<endl;
        if(max/m==0)
            printf("%d\n",n);
        else
            printf("%d\n",j);

        }
}

/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;

int main()
{

    int n,m,r=0;
    cin>>n>>m;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    pair<int,int>pair1;
    vector<pair<int,int>>fanta;
    for(int i=0;i<n;i++)
    {
        fanta.push_back(make_pair(arr[i],i+1));

    }
    //sort(fanta.begin(),fanta.end());
   // int p=fanta[n-1].first;
    //int q=fanta[n-1].second;
    for(int i=0;i<n;i++)
    {
      //  if(fanta[i].first==0)
       //{ break;}
        r=fanta[i].second;
    if(fanta[i].first>m)
    {
        int x=fanta[i].first-m;
        fanta.push_back(make_pair(x,r));
        n=n+1;
    }
    else
    continue;

    }
    cout<<r;

 /*  for(int i=0;i<n;i++)
    {
        cout<<fanta[i].first<<" "<<fanta[i].second<<"\n";
    }*/

   // printf("Hello World");

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int queu[11111],arr[111];

int main()
{
  int n,m,head=0,tail=0;
  scanf("%d %d",&n,&m);
  while(tail<n)
  {
    scanf("%d",&queu[tail++]);
    arr[tail-1]=tail;
  }
  while(head!=tail)
  {
    if(m>=queu[head])head++;
    else
    {
      arr[tail]=arr[head];
      queu[tail++]=queu[head++]-m;
    }
  }
  printf("%d",arr[tail-1]);
  return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int Studentscount, candynum, T = 0, index, tmp;
	cin >> Studentscount >> candynum;
	int * arr = new int[Studentscount];
	tmp =0;
	for (int i = 0; i < Studentscount; i++)
	{
		cin >> arr[i];
		if (arr[i] < candynum)
			T++;
		else if (arr[i]> candynum && arr[i]>=tmp )
		{
			tmp = arr[i];
			index = i;

		}
	}
	if (T == Studentscount)
	{
		cout << T << endl;
	}
	else
	{
		cout << index + 1 << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
	int n, m,i,k;
	cin>>n>>m;
	vector<int>a(n);
	for(i=0;i<n;i++){
		cin>>a[i];
	}int ans=n;
	if(*max_element(a.begin(),a.end())>m)
	{k=(*max_element(a.begin(),a.end()))/m;}
	for(i=0;i<n;i++){
		if(a[i]/m==k){
			ans=i;
		}
	}
	cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; int m; cin>>n>>m;
    int maxi=-1,maxi_index;
    for(auto i=0;i<n;++i){
        int temp;
        cin>>temp;
        maxi=temp-m;
        if(maxi>0){
            maxi_index=i+1;
        }
        else if(i==n-1)maxi_index=n;
    }
    cout<<maxi_index;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int n, a[105], s, s1, s2, m;
pair <int, int> x[105];

int main()
{
    cin >> n >> m;
    for (int i=1;i<=n;i++)
        cin >> a[i],x[i]=make_pair(a[i],i);
    int r=n, l=1;
    while (true)
    {
        int ll=l,  rr=r;
        if (x[l+1].first==0)
        {
            cout << x[l-1].second;
            return 0;
        }
        for (int i=l;i<=r;i++)
        {
            if (x[i].first-m>0)
            {
                x[rr++]=make_pair(x[i].first-m,x[i].second);
            }
            if (x[i].first-m<=0)
            {
                ll++;
            }
        }
        //cout << l << " " << r << endl;
        l=ll,r=rr;
    }
}

#include <bits/stdc++.h>
using namespace std;
int redondeo(float x){
	int z = x;
	int j = x*10;
	z = z*10;
	if(j-z==0){
		return x;
	}
	else
		return x+1;
}

int main(){
	int n,last=0;
	float a,m;
	cin>>n>>m;
	int cola[n];

	for(int i=0;i<n;i++){
		cin>>a;

		if(a<=m)
			cola[i] = -1;

		else
		cola[i] = redondeo(a/m);
	}

	for(int i=0;i<n;i++){
		if(cola[i]!=-1&&last<=cola[i])
			last = i;
	}
	if(last!=0)
		cout<<last+1<<"\n";
	else
		cout<<n;
		return 0;

}

	/*m % ai
6 4
1 1 2 2 3 3
R:6

5 2
1 3 1 4 2
R:4

7 3
6 1 5 4 2 3 1

*/

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;

void solve()
  {
  int n, m;

  cin >> n >> m;

  vector<double> a(n);
  for (auto& it : a)
    cin >> it;

  for (auto& it : a)
    it /= m;

  auto max_it = max_element(a.begin(), a.end());

  size_t res = 0;
  for (size_t i = n; i > 0; --i)
    {
    if (a[i-1] == *max_it)
      {
      res = i;
      break;
      }
    }

  cout << res;
  }

int main()
  {
  solve();
  return 0;
  }

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,max=0;
    cin>>n>>m;
    int a[n],x[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        int count=0,p=a[i];
        while(p)
        {
            p/=m;
            count++;
        }
        x[i]=count;

        if(x[max]<=x[i]) max=i;
    }
    cout<<max+1;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<cassert>

using namespace std;

int a[105];

int main(){
    //freopen("in.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; ++i) cin >> a[i];

    int maxv = -1, maxi;
    for(int i = n-1; i >= 0; --i){
        if(maxv < a[i]){
            maxv = a[i];
            maxi = i;
        }
    }

    cout << maxi+1;

    return 0;
}

#include <iostream>
#include <vector>
using namespace std;
#define LL long long

int main() {
	int n;
	double m;
	cin >> n >> m;
	int* p = new int[n+1];
	double* cnt = new double[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
		cnt[i] = p[i] / m;
	}
	int max = INT_MIN, sid;
	for (int i = 1; i <= n; i++) {
		if (cnt[i] >= max) {
			max = cnt[i];
			sid = i;
		}
	}
	cout << sid;

	delete[]p;
	return 0;
}

#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e18;
bool imp=true;

void solve(){
    ll n,m;cin>>n>>m;
    ll a[n];ll ma=0,j=0;
    bool ans=false;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>m)
        ans=true;
        if(ma<a[i]){
            ma=a[i];
            j=i;
        }
    }
    if(ans==true){
        cout<<j+1;
    }
    else cout<<n;

}
int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    //if(imp)cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define INF 1e9
#define MAXN 310
using namespace std;
struct moo
{
    int a;
    int b;
}num[11000];
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &num[i].a);
        num[i].b = i + 1;
    }
    int sum = n;
    int cc = n;
    int anss = 0;
    for (int i = 0; i < 10000; i++)
    {
        if (num[i].a - m>0)
        {
            num[cc].b = num[i].b;
            num[cc++].a = (num[i].a -= m);
        }
        else
        {
            sum--;
        }
        if (sum == 1)
        {
            anss = num[i + 1].b;
        }
    }
    printf("%d\n", anss);
}

#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:256000000")

#include <time.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cmath>
#include <numeric>
#include <algorithm>

#include <bitset>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <iterator>

#define sqr(x) ((x)*(x))
#define ll long long
#define pub push_back
#define mp make_pair
#define fst first
#define snd second
#define eps 1e-6
#define sz(c) int((c).size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, -1, 0, 1 };
const double pi = 3.14159265358979323846264;

using namespace std;

clock_t t;
int MAX = -2e9, MIN = 2e9;
double A[1000001];

int main(){
#ifdef ColtPython
	fstream in("input.txt"), out("output.txt", 2);
	ostream_iterator <int> output(cout, " ");
	t = clock();
#endif

	int n, m, inc = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		cin >> A[i];
		A[i] /= m;
	}

	double maxx = *max_element(A, A + n);
	for (int i = 0; i < n; i++){
		if (A[i] == maxx) inc = i;
	}
	cout << ++inc;

#ifdef ColtPython
	t = clock() - t;
	cerr << setprecision(5) << fixed;
	cerr << "\n\n===Time: " << (double)t / CLOCKS_PER_SEC << "===" << endl;
	system("pause>>void");
#endif
	return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <bitset>

using namespace std;

#define FOR(i,n) 		for(int(i)=0;(i)<(int)(n);(i)++)
#define FORN(i,a,b,c) 	for(int(i)=a;i<(int)(b);i+=(c))
#define RES(x,nilai)	memset(x,nilai,sizeof(x));
#define pb              push_back
#define mp              make_pair
#define INF				1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int  n , m ,x[110], ada, ans;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("13.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> m; int maks = -INF;
	for (int i = 0 ;i < n ; i++) {
		cin >> x[i];
	}

	ada = n; ans = 0;
	if (ada > 2) {
		while (true) {
			for (int i =0 ; i < n ; i++) {
				if (ada != 1) {
					if (x[i] != 0) {
						if (x[i] <= m) {x[i] = 0; ada--;}
						else {x[i] = x[i] - m;}
					}
				}
				else {
					if (x[i] != 0) {ans = i; break;}
				}
			}
			if (ans != 0) {break;}
		}
	}
	else if (ada == 1) {
		ans = 0;
	}
	else if (ada == 2) {
		if (x[0] <= m ) {ans = 1;}
		else if (x[1] > m) {
			if (x[0] > x[1]) {ans = 0;}
			else {ans = 1;}
		}
		else ans = 0;
	}

	cout << ans+1 << endl;

    return 0;
}

#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
int main(){
    int m,n;
    int k;
    int a[105];
    while(cin>>n>>m){
        int max=-1;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            if(a[i]>max)
            {max=a[i];
              k=i;}
        }
        if(max<=m)   cout<<n<<endl;
        else {
            cout<<k<<endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
#define For(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define ll long long
#define rng(x) x.begin(),x.end()
#define b(x) x.begin()
#define e(x) x.end()
#define me max_element
using namespace std;
int main()
{
     int i,n,y,k,max,ctr=0;
     cin>>n>>k;
     vi a;
     For(i,0,n)
     {
       cin>>y;
       a.pb(y);
     }
     For(i,0,n)
     {
       if(a[i]>k)
       {
         max = *me(rng(a));
         auto itr = find(rng(a),max);
         cout<<distance(b(a),itr)+1;
         break;
       }
       else
       {
         ctr++;
       }
     }
     if(ctr==a.size())
     {
       cout<<n-1;
     }
     return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int index=0;
int main(){
    int m,n,max=-1;
    cin>>n>>m;
    for(int i=0; i<n; i++){
        int a;
        cin>>a;
        if(a/m>=max){
            if(a%m!=0)
                max=a/m;
                else
                    max=a/m+1;

            index=i+1;
        }
    }
    cout<<index;
}

#include<iostream>
#include<iomanip>
#include<map>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cctype>
#include<string>
#include<stdlib.h>
using namespace std;

int main()
{
   int n,m;
   cin>>n>>m;
   int arr[1001];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
       arr[i]=ceil(arr[i]/float(m));
   }
   int max=arr[0],ind=0;
   for(int i=1;i<n;i++)
   {
       if(arr[i]>=max)
       {
           max=arr[i];
           ind=i+1;
       }
   }
   cout<<ind;

return 0;

}

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,a,rest=-99,last;
cin>>n>>m;
for(int i=0;i<n;i++){
	cin>>a;

		 int res=a-m+(a%m);
		if(res>=rest){
			rest=res;
			last=i+1;

	}
}

cout<<last;
	return 0;
}

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
struct anode
{
    int id;
    int wei;
};
anode a[105];
int m;

bool cmp(anode aa, anode bb)
{
    double mm = m;
    if(aa.wei/m == bb.wei/m && aa.wei%m && aa.wei%m)
        return aa.id > bb.id;
    else
        return aa.wei/mm > bb.wei/mm;
}

int main()
{
    int n;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        for(int i = 0; i < n; ++i)
        {
            scanf("%d",&a[i].wei);
            a[i].id = i+1;
        }
        sort(a,a+n,cmp);
        printf("%d\n",a[0].id);
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n , m;
    cin >> n >> m;
    vector<pair<int,int> > p;
    for(int i = 0 ; i < n ; ++i){
        int x;
        cin >> x;
        p.push_back({x,i+1});
    }
    sort(p.begin(),p.end());
    cout << p[n-1].second;
}

#include<bits/stdc++.h>
#define ll long long

using namespace std;

main()
{
    int n,m,arr[105],res;

    scanf("%d %d",&n,&m);

    for(int i=1;i<=n;i++)
        scanf("%d",&arr[i]);

    for(int i=1;i<=n;i++)
    {
        for(int i=1;i<=n;i++)
        {
            if(arr[i]>0)
            {
                arr[i]-=m;
                res=i;
            }
        }
    }

    printf("%d",res);
}

//headerfile//////////////
#include <bits/stdc++.h>
//define///////////////////
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)
#define szo(x) ((int)sizeof(x))
#define szs(x) ((int)(x).size())
#define S2(x,y) scanf("%d%d",&x,&y)
#define loop(i,a,b) for(int i = a; i < b; i++)
#define revloop(i,a,n) for (int i=n-1;i>=a;i--)
//////typedef//////////
typedef long long int ll;
typedef unsigned long long int ull;
const ll mod=1000000007;
const int INF = 1000000000;
using namespace std;
//////functions////////
ull pow2(ull s) {if(s!=0 && (s & (s-1)))return 0;else return 1;}
ull powany(ll a,ll b) {ull res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ull prime(ull n) {if(n==2||n==3)return 1;if(n%2==0||n%3==0)return 0;for(ull i=7;i*i<n;i+=6)if(n%(i)==0||n%(i-2)==0)return 0;return 1;}
//head//////////////////
int main() {
int n,k;
cin>>n>>k;
int c=0,t=n-1;
int ar[1000]={0};
for (int i = 0; i < n; ++i)
{
	cin>>ar[i];
}
for (int i = n-1; i >=0; --i)
{
	if (c==0)
	{ //cout<<"P";
		if (ar[i]>k)
		{
			t=i;c=1;//cout<<t;
		}

	}
	else
	{ //cout<<" ";
       if (ar[i]>k && ar[t]/k < ar[i]/k && ar[i]-ar[t]>=k)
       {
       	t=i;
       }
	}
}
cout<<t+1;
 return 0;
}

#include <iostream>
#include <algorithm>
#include <fstream>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
	long n, m, k, x;
	scanf("%ld%ld%ld", &n, &m, &k);

	if(m > n) swap(n, m);

	if(k > n+m-2) printf("-1\n");
	else  {
		if(k+1 <= n) x = max(n/(k+1) * m , m/(k+1) * n);
		else {
			x = max(m/(k-n+2), n/(k-m+2));
		}

		printf("%ld\n", x);
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,t1=0,t2=0,c=0,mx;
    cin>>n>>m;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]>=t1)
        {
            t1=v[i];
            mx=i;
        }
    }
    for(int i=0;i<n;i++)
    {
        t1=v[i]/m;
        t2=v[mx]/m;
        if(t2-t1==1 && v[i]%m!=0)
        {
            c=i;
        }
    }
    if(c>mx)
    {
        cout<<c+1<<endl;
    }
    else
    {
        cout<<mx+1<<endl;
    }
}

#pragma warning ( disable : 4996 )
#define mainhar
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <time.h>
#include <algorithm>
#include <deque>
#include <list>
#include <bitset>
#include <set>
#include <iomanip>
using namespace std;
typedef __int64 ll;

void solve() {
    int n , m;
    cin >> n >> m;
    vector <int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int max = 0;
    int maxn = 0;
    for (int i = 0; i < n; i++)
    if (a[i] >= max) { max = a[i]; maxn = i;  }
    cout << maxn + 1;
}

int main() {
#ifdef mainhard
    freopen("input.txt" , "r" , stdin);
    freopen("output.txt" , "w" , stdout);
#endif
    solve();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i,j=0,n,q,sum=0,flag=0;

    cin>>n;
    cin>>q;
    vector<int>vect(n);

    for(i=0;i<n;i++)
    {
         cin>>vect[i];

    }
    int x=((vect[n-1]/q)+(vect[n-1]%q));
    int ans=n-1;
    // for(i=n-1;i>0;i--)
    // {
    //   if((x<=(vect[i]%q) && vect[i]>q) && flag==0)
    //   {    x = vect[i]%q;
    //         ans=i;
    //         flag=1;
    //   }
    // }
    for(i=n-1;i>0;i--)
    { if(x<((vect[i]/q)+abs((vect[i]%q)-q)))
      {
          ans=i;
          x = ((vect[ans]/q)+(vect[ans]%q));

      }
    }
    cout<<ans+1;

return 0;
}

/*6 4
1 1 2 2 3 3
outputCopy
6*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,i,b=0;
    cin>>n>>m;
    int arr[n];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(i=0;i<n;i++)
    {
        if(b<arr[i])
        b=arr[i];
    }
    if(b<=m)
    cout<<n;
    if(b>m)
    {
        for(i=n-1;i>=0;i--)
        {
            if(b==arr[i])
            {
                cout<<i+1;
                break;
            }
        }
    }
}

#include <bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define f(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,n) f(i,1,n)
#define rrep(i,n) rf(i,n-1,0)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mii map<int,int>
#define mci map<char,int>
#define inf (int)(1e18)
using namespace std;

void fast_IO_file()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	fast_IO_file();

	int n, k, c;
	cin >> n >> k;

	int a[n];

	multimap<int, int> m;

	rep(i, n)
	{
		cin >> a[i];
		m.insert(make_pair(a[i] / k, i));
	}
	int max = -1;
	int ans = 0;
	for (auto it : m)
	{
		if (it.ff >= max)
		{
			max = it.ff;
			ans = it.ss;
		}

	}

	cout << ans;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a,last;
	cin>>n>>m;
	float cola[n];

	for(int i=0;i<n;i++){
		cin>>a;
		if(a<=m||m%a==0){
			cola[i] = 0;
		}
		else
		cola[i] = m/a;
	}

	for(int i=0;i<n;i++){
		if(cola[i]!=0&&last>=cola[i])
			last = i;
	}
	if(last!=0)
		cout<<last+1<<"\n";
	else
		cout<<n;
		return 0;

}
	/*m % ai
6 4
1 1 2 2 3 3

5 2
1 3 1 4 2

7 3
6 1 5 4 2 3 1

*/

#include<iostream>
#include<algorithm>
using namespace std ;
int main (){
	int a,b,count=0;
	cin>>a>>b;
	int c[a]={0},d[a]={0};
	for(int i=0;i<a;i++){
		cin>>c[i];
	}
		for(int i=0;i<a;i++){
		d[i]=c[a-i-1];
	}
	int r=*max_element(d,d + a);
	for(int i=0;i<distance(d,max_element(d,d + a));i++){
	if((r-d[i]<b)&& (d[i]>b)){
		cout<<a-i;
		count++;
		break;
	}
}
	if(count==0)
	cout<<a-distance(d,max_element(d,d + a));

}

#include <bits/stdc++.h>
#define ULL                 unsigned long long
#define LL                  long long
#define LD                  long double
#define PI                  3.14159265359
#define ahmed_elmotaz       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// for(int i=0;i<t;i++){}
using namespace std;

int main()
{
    ahmed_elmotaz
    int t,z,ans1=0,ans=0;
    cin>>t>>z;
    LL s[t];
    for(int i=0;i<t;i++){
        int k;
        cin>>k;
        k=k/z;
        s[i]=k;
    }
    for(int i=0;i<t;i++){
        if(s[i]>=ans1){
            ans1=s[i];
            ans=i+1;
        }
    }
    cout<<ans;
    return 0;
}
/*
a=97  A=65
z=122 Z=90
0=48
prime number of ones in their binary representation

*/

#include<bits/stdc++.h>
using namespace std;

#define mkp             make_pair
#define nl              cout << "\n"
#define sp              cout << " "
#define fi              first
#define se              second
#define pb              push_back
#define all(x)          (x).begin(),(x).end()
#define rep1(i, k, n)   for(i = k; k < n ? i < n : i > n; k < n ? ++i : --i)
#define vel(v, w)       for(auto (w) = (v).begin(); (w) != (v).end(); ++(w))
#define velr(x, w)      for(auto (w) = (x).end() - 1; (w) != (x).begin() - 1; --(w))
#define rep2(i, n)      for(i = 0; i < n; ++i)
#define deb1(a)         cout << a << " "
#define deb2(a, b)      cout << a << " " << b << " "
#define deb3(a, b, c)   cout << a << " " << b << " " << c << " "
#define deb4(a, b, c,d) cout << a << " " << b << " " << c << " " << d << " "
#define sz(v)           (ll)(v.size())
#define INF             ll(1e18)
#define PI              3.14159265
#define LOOP(_1,_2,_3,NAME,...) NAME
#define rep(...)        LOOP(__VA_ARGS__, rep1, rep2)(__VA_ARGS__)
#define DEBUGGER(_1, _2, _3, _4, NAME,...) NAME
#define deb(...)        DEBUGGER(__VA_ARGS__, deb4, deb3, deb2, deb1)(__VA_ARGS__)

typedef unsigned long long  ull;
typedef long long           ll;
typedef long double         ld;
typedef vector<ll>          vll;
typedef pair<ll, ll>        pp;
typedef pair<ll, pp>        ppp;

mt19937 rang(chrono::steady_clock::now().time_since_epoch().count());

ll mult(ll x,ll y);
ll add(ll x,ll y);
ll powmod(ll base,ll expo);
ll mod( ll n, ll m);

const ll MOD = 1e9 + 7;
const ll N = 3e5;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //Start here
    //ll t = 5;
    //cin >> t;
   int n,m,j=0,temp,count=0;
cin>>n>>m;
int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
while(1){
	if(a[j]==0) break;
	if (a[j]>m)
		{a[j]-=m;temp=a[j];count++;for(int m=j+1;m<n;m++){
			a[m-1]=a[m];
		}
		a[n-1]=temp;
	}
	else
	{
		a[j]=0;
		for(int m=j+1;m<n;m++){
			a[m-1]=a[m];
		}
		a[n-1]=0;
		count++;
	}

}
cout<<count;
}

#include <iostream>

using namespace std;

int main()
{
	int n, m, max = 0, maxi, a, c;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		if (max <= a/m)
		{
			max = a/m;
			maxi = i;
		}
	}
	cout << (maxi + 1) << endl;
	return 0;
}

#include"stdio.h"
#include"iostream"
#include"string"
using namespace std;

int main()
{
	string s;
	bool TF = true;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		int l = 0, r = s.length() - 1;
		while (l < r)
		{
			if (l == i)
				l++;
			if (r == i)
				r--;
			if (s[l] != s[r])
			{
				TF = false;
				break;
			}
			TF = true;
			l++;
			r--;
		}
		if (TF == true)
		{
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
}

#include <iostream>
using namespace std;
int main(int argc, char** argv) {
short n,m,li;
cin>>n>>m;
short x[n],mx=0,mxi=n-1;
for(short i=0;i<n;i++){
	cin>>x[i];
	if(x[i]>=mx){
		mx=x[i];
		mxi=i+1;
	}
}
cout<<mxi<<endl;
return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n; cin>>n;
	int m; cin>>m;
	vector<int> a;
	int flag = 0;
	for(int i=0;i<n;i++)
	{
		int x; cin>>x;
		a.push_back(x);
		if(x>m)
		{
			flag = 1;
		}
	}
	int res = -1;
	if(flag == 0)
	{
		res = n;
	}
	else
	{
		int max = a[0],max_ind;
		for(int i=1;i<n;i++)
		{
			if(a[i] >= max)
			{
				max = a[i];
				max_ind = i;
			}
		}
		res = max_ind+1;
	}
	cout<<res<<"\n";
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N = 2e5+5 ;
//😁😁😁😁😁😁😁😁😁😁😁

void Never_give_up()

{
   int n,m; cin>>n>>m;
   int mx=-1,ans=0;
   int a[n];
   for(int i=0;i<n;++i)
   {
       cin>>a[i];
       a[i] = ceil(a[i]/m);
       if(a[i]>=mx)
        ans=i+1,mx=a[i];
   }
   cout<<ans;
}

signed main() {
ios::sync_with_stdio(false);
cin.tie(0);

int tc=1;
//cin >> tc;
for (int iTest = 0; iTest <tc; ++iTest)
 {
Never_give_up();
 }

 return 0;
}

#include <iostream>
using namespace std;
int w[100001];
int main() {
	long long b,i,n,cnt=0,m,ans=0;
	cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        cin>>w[i];
    }
    for(i=1;i<=n;i++)
    {
        w[i]/=m;
      if(w[i]!=0 && ans<w[i])
      {
          ans=w[i];
          cnt=i;
      }
    }
    if(cnt==0)
cout<<n;
else
    cout<<cnt;
}

#include <vector>
#include <iostream>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <bitset>
#include <limits>

#define ll long long
#define lli long long int

using namespace std;

#define MAX 1000000007

int main()
{
  int n,m;
  scanf("%d %d",&n,&m);
  vector<int> a(n,-1);
  int max = -1;
  int ind = -1;
  int flag =0 ;
  for(int i=0;i<n;i++) {
    scanf("%d",&a[i]);
    if(a[i]>=max) {
      max=a[i];
      ind = i;
    }
    if(a[i]>m)
      flag=1;
  }
  if(flag==1)printf("%d\n",ind+1);
  else printf("%d\n",n);
  return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int n, m;
	int *children;

	int turns = 0, index = 0;

	cin >> n >> m;
	children = new int[n];

	for(int i = 0; i < n; i++)
	{
		cin >> children[i];
	}

	for (int i = 0; i < n; i++)
	{
		if(ceil(children[i] / 2) >= turns)
		{
			turns = ceil(children[i] / 2);
			index = i + 1;
		}
	}

	cout << index << endl;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k,s=0;
    cin>>n>>m;
    int a[n];
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]>=s){
            k=i;
            s=a[i];
        }
    }
    cout<<k<<endl;
}

#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <stdio.h>
using namespace std;
vector<unsigned long long > dis,dp,vis;
vector<vector<unsigned long long > > adj;

signed main(){
long long int n,m;
cin>>n>>m;
 int a[n],b[n];
 long long int sum = 0;
for(int i = 0; i <n;  ++i)
{
cin>>a[i];
}
int ans = -1e6; int count  = 0;
while(true) {
for(int i = 0 ; i <n; i++)
{
	if(a[i] - m <=0){
	a[i] = -1000; count++; }
	else
	a[i] -= m;
	// for(int x: a) cout<<x<<" ";
	// cout<<endl;
	if(count==n-1)
{
	for(int j =0; j<n; j++)
	if(a[j]!=-1000)
	ans  = j+1;
	break;
}

}
if(ans!=-1e6)
break;

}

cout<<ans;

return 0;
}

#include <iostream>

using namespace std ;
int main(){
    int m , n;
    int arr[100];
    int no_children[100]; int children =0;
    int temp ; int large =0 ;
    int pos =0;
    cin >> n;
    cin >> m;
    for (int i=0; i <n; i++){

        cin >> temp ;
        arr[i]=temp;
        if (temp >m){

        children++;

        }}

    for (int i=0; i<n ; i++){

        if (large <= arr[i]){

            large = arr[i];
            pos = i+1;
        }

    }

    cout << pos ;

}

#include<stdio.h>

int main()
{
    int a[100];
    int n,m,dem,i,z,max=0,d;
    scanf("%d %d",&n,&m);
    for (i=0;i<n;i++)
        {
                  scanf("%d",&a[i]);
                  if (m<a[i])
                  {
                   d++;
                    z=a[i]/m;
                    if (max<=z)dem=i;
                  }
                  if (i==n-1) if (d==0) dem=n-1;
        }
    printf("%d",dem+1);

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n, m, maxIndex = 0,x, Max, d;
	scanf("%d %d",&n, &m);
	Max = m,d = 2;
	for(int i = 1; i <= n; i++) {
		scanf("%d",&x);
		if(Max+1 <= x) {
			maxIndex = i;
			if((Max*d)+1 <= x) {
				Max = x;
			}
		}
	}
	if(maxIndex)
		printf("%d",maxIndex);
	else
		printf("%d",n);

}

#include <iostream>
#include <string>
using namespace std;
main()
{
      int n,m;
      cin>>n>>m;
      int i,a[n],br[n],max=0,pomi;
      for(i=0;i<n;i++)
      {
      cin>>a[i];
      }
      for(i=n;i>0;i--)
      {
      br[i]=a[i]/m;
      if(a[i]>0)
      {
      if(a[i]%m!=0)
      {
      br[i]++;
      }
      }
      if(br[i]>max)
      {
      max=br[i];
      pomi=i;
      }
      }
      cout<<pomi+1;
      cin.get();
      cin.get();
}

	#include <bits/stdc++.h>
	using namespace std;

	int main(int argc, char ** argv) {
	int n,m,maxE=0,maxipos=0,cnt=0,pos=0;
	cin>>n>>m;
	int a[n];
	for(int i=0 ;i<n;i++){
		cin>>a[i];
		if(maxE<=a[i]){
			maxE=a[i];
			maxipos=i;
		}
	}
	while(a[maxipos]>0){
		for(int i=0 ;i<n ; i++){
			if(a[i]==0)continue;
			a[i]-=m;
			if(a[i]<0){
				a[i]=0;
				for(int j=0 ;j<n ; j++){
					if(a[j]!=0){
						cnt++;
						pos=j;
				}
			}
				if(cnt==1){
				cout<<pos+1;
				return 0;
				}
			}
			cnt=0;
		}
	 }
}

#include <iostream>
using namespace std;

int main() {
        int child, min, lastIndex = -1, roundStayed = -1;
        cin >> child >> min;

        for (int i = 0; i < child; ++i) {
                int count;
                cin >> count;

                if (count / min >= roundStayed) {
                        lastIndex = i + 1;
                        roundStayed = count / min;
                }
        }

        cout << lastIndex << endl;
        return 0;
}

#include<iostream>

using namespace std;
typedef long long inta;

int main()
{
     int n,m,largest=0,large=0;
     cin>>n>>m;
     int a[n];
     for(int i=0;i<n;i++)
     {
         cin>>a[i];
         if(a[i]>m)
            large = i;
         if(a[i] >=a[largest])
            largest = i;
     }

     if((a[largest] - a[large] > m))
     cout<<largest+1;
     else
        cout<<large+1;
}

#include<bits/stdc++.h>
using namespace std;
#define deb(x) cout << ">" << #x << '=' << x << endl;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("outputa.txt", "w", stdout);
#endif
	int n, k;
	cin >> n >> k;
	vector<int>v;
	for (int i = 0; i < n; i++)
	{	int a;
		cin >> a;
		v.push_back(a);
	}
	int max = v[0] / k;
	int c = 0;
	for (int i = 0; i < n; ++i)
	{
		if (max <= (v[i] / k))
		{
			c = i;
			max = v[i] / k;
		}

	}
	if (max == 0)
		cout << n << endl;
	else
		cout << c + 1 << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a,last;
	cin>>n>>m;
	int cola[n];

	for(int i=0;i<n;i++){
		cin>>a;
		if(a<=m){
			cola[i] = 0;
		}
		else
		cola[i] = m%a;
	}

	for(int i=0;i<n;i++){
		if(cola[i]!=0)
			last = i;
	}
	if(last!=0)
		cout<<last+1<<"\n";
	else
		cout<<n;
		return 0;

}
	/*m % ai
6 4
1 1 2 2 3 3

5 2
1 3 1 4 2

7 3
6 1 5 4 2 3 1

*/

#include<bits/stdc++.h>
using namespace std;
int main(){

     int n,m;
     cin>>n>>m;
     int a[n],max=0,max1=0;
     int num=n-1;
     for(int i=0;i<n;i++){
          cin>>a[i];
        if(a[i]/m>=max && a[i]%m>0)
         max=a[i]/m;

        if(max1<a[i]){
          max1=a[i];
          num=i;
           }
}
     if(m==1){
        cout<<num+1;
       return 0;}

     for(int j=0;j<n;j++){

       if(a[j]>(max*m))
         num=j;

}
     cout<<num+1;
  }

#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

 int main()
 {
 	//freopen("cin.txt","r",stdin);
	int n,m,mx=0,last=0;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
	{
		int a;
		cin>>a;
		if (a/m >= mx)
		{
			last=i+1;
			mx=m/a;
		}
	}
	cout<<last;
 	return 0;
}

#include <iostream>
using namespace std;

int main() {
	//code
	int n,m,i;
	cin>>n>>m;
	int a[105]={0};
	for(i=0;i<n;i++)
	cin>>a[i];
	int max=0,ans;
	for(i=0;i<n;i++){
	    a[i]/=m;
	    if(max<=a[i]){
	        ans=i;
	        max=a[i];
	    }
	}
	cout<<ans+1<<endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <fstream>
#include <algorithm>
#include <string>
//#include <cstdio>
//#include <cstdlib>

using namespace std;

int main()
{
	//freopen("Test1.txt", "r", stdin);
	//freopen("Test2.txt", "w", stdout);

	int n = 0, m = 0;
	int a[100] = {};
	cin >> n >> m;
	int max = 0;
	int i = 0;
	for (; i < n; ++i)
	{
		cin >> a[i];
		if (a[i] > a[max]) max = i;
	}
	if (m < a[max]) cout << max + 1;
	else cout << n;
	return 0;
}

 #include<bits/stdc++.h>
#include <string>
#define fio ios_base::sync_with_stdio(false)
using namespace std;
#define ll long long int
#define dd long long double
#define pb push_back
const int MAXN = 200100;
int main()
{
	ios::sync_with_stdio(false);
      cin.tie(NULL);
      #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
	  #endif
     int n,t,count=0;
     cin>>n>>t;
     int a[n];
     for(int i=0;i<n;i++)
     {
      cin>>a[i];
      if(a[i]>t)
      {
        count++;
      }
      a[i]-=t;
     }
     int index=n-1;
     while(count>1)
     {
      for(int i=0;i<n;i++)
      {
        if(a[i]>0 && a[i]-t<=0)
        {
          count--;
          index=i;
        }
        a[i]-=t;
      }
     }
     cout<<index+1;
    }

#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <bitset>

using namespace std;

#define FOR(i,n) 		for(int(i)=0;(i)<(int)(n);(i)++)
#define FORN(i,a,b,c) 	for(int(i)=a;i<(int)(b);i+=(c))
#define RES(x,nilai)	memset(x,nilai,sizeof(x));
#define pb              push_back
#define mp              make_pair
#define INF				1000000000

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int  n , m ,x[110], ada, ans;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("13.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> m; int maks = -INF;
	for (int i = 0 ;i < n ; i++) {
		cin >> x[i];
		if (x[i] >= maks) {maks = x[i]; ans = i;}
	}
/*
	ada = n; ans = 0;
	while (true) {
		for (int i =0 ; i < n ; i++) {
			if (ada != 1) {
				if (x[i] != 0) {
					if (x[i] <= m) {x[i] == 0; ada--;}
					else {x[i] = x[i] - m;}
				}
			}
			else {
				if (x[i] != 0) {ans = i; break;}
			}
		}
		if (ans != 0) {break;}
	}
*/
	cout << ans+1 << endl;

    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main(){
	int n,candy,min,ans;
	cin>>n>>candy;

	vector <int> soldier(n);
	for(int i=0;i<n;i++) cin>>soldier[i];

	min=soldier[0];
	for(int i=0;i<soldier.size();i++){
		soldier[i]-=candy;
		if(min<=soldier[i]){
			min=soldier[i];
			ans=i;
		}
	}

	cout<<ans+1;

	return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    int maxx;
    int *arr = new int[n];
    for (int i = 0; i < n; i++){
        cin >> arr[i]; if (arr[i] > m)maxx = i;
    }

    cout << maxx+1;
    }

#define _CRT_SECURE_NO_DEPRECATE
#define _SECURE_SCL 0
#pragma comment(linker, "/STACK:256000000")

#include <time.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cmath>
#include <numeric>
#include <algorithm>

#include <bitset>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <iterator>

#define sqr(x) ((x)*(x))
#define ll long long
#define pub push_back
#define mp make_pair
#define fst first
#define snd second
#define eps 1e-6
#define sz(c) int((c).size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, -1, 0, 1 };
const double pi = 3.14159265358979323846264;

using namespace std;

clock_t t;
int MAX = -2e9, MIN = 2e9;
ll A[1000001], B[101];
bool mark[101];

int main(){
#ifdef ColtPython
	fstream in("input.txt"), out("output.txt", 2);
	ostream_iterator <int> output(cout, " ");
	t = clock();
#endif

	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		cin >> A[i];
		A[i] = ceil((double)A[i] / m);
	}

	int maxx = *max_element(A, A + n), imax;

	for (int i = 0; i < n; i++){
		if (A[i] == maxx) imax = i;
	}
	cout << imax;

#ifdef ColtPython
	t = clock() - t;
	cerr << setprecision(5) << fixed;
	cerr << "\n\n===Time: " << (double)t / CLOCKS_PER_SEC << "===" << endl;
	system("pause>>void");
#endif
	return 0;
}

#include<iostream>

using namespace std;
int main()
{

	int n = 0, m = 0, pos = 0, max = 0, maxpos = 0;
	cin >> n;
	cin >> m;

	for (int i = 0; i < n; i++)
	{
		int x = 0;
		cin >> x;

		pos++;
		if (x <= m)
		{
			continue;
		}
		else if (x / n>max)
		{
			max = x / n;
		maxpos = pos; }
	}

	if (maxpos==0)
	{
		cout << pos << endl;
	}
	else{
		cout << maxpos << endl;
	}

}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<cstdlib>
#include<map>
#include<list>
#include<bits/stdc++.h>
using namespace std;

//	GC

#define in(a) scanf("%d",&a)
#define inll(a) scanf("%lld",&a)
#define ins(a) scanf("%s",a)
#define out(a) printf("%d\n",a)
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define outll(a) printf("%lld\n",a)
#define vec vector<int>
#define mod 1000000007
#define sz(v) v.size()
#define mem(a,b) memset(a,(b),sizeof(a))
#define mp make_pair
#define ll long long
#define pa pair<int,int >
#define vecp vector<pa>

int main()
{
	int n,m,a[100010],i;

	in(n);		in(m);

	fo(i,n)		in(a[i]);

	int ans=n-1;		int maxi=0;

	fo(i,n)
	{
		if(a[i]<=m)		continue;
		else	if(a[i]-m > maxi)  {	ans=i;	maxi=a[i]-m;		}
	}

	cout<<ans+1;

}

#include<bits/stdc++.h>
using namespace std;

struct ha{
	int need,num;
}hh[102];

int main(){
	int a,b,temp=0,na,fin,num=1; cin>>a>>b;
	queue <ha> q;
	for(int i=0; i<a; i++){
		scanf("%d", &na);
		q.push((ha){na,i+1});
	}
	while(1){
		if(q.front().need<=b){
			q.pop();
		}
		else{
			q.push((ha){q.front().need-b,q.front().num});
			q.pop();
		}
		if(q.size()==1){
			break;
		}
	}
	cout<<"48";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[1000],i,f=0,m,t,p;
    cin>>n>>m;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    while(1)
    {
        for(i=1; i<=n; i++)
        {
            a[i]=a[i]-m;
        }
        for(i=1; i<=n; i++)
        {
            if(a[i]>m)
            {
                f=0;
                break;
            }
            else f=1;
        }
        if(f==1)break;
    }
   // for(i=1; i<=n; i++)cout<<a[i]<<" ";
    //cout<<endl;
    for(i=1; i<=n; i++)
    {
        if(a[i]>0)
        {
            t=i;
            f=1;
        }
    }
    if (f==1)cout<<t<<endl;
    else cout<<n<<endl;

}

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
int n,m,k;
int main()
{
    cin>>n>>m;
    int ans=-1,ansp;
    for(int i=0;i<n;i++)
    {
        cin>>k;
        int p=k/m;
        if(k%m) p++;
        if(p>=ans)
        {
            ans=k/m;
            ansp=i+1;
        }
    }
    cout<<ansp<<endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,m;
	cin>>n>>m;
	int li,max=0;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]>=max)
		max=a[i];
		li=i;
	}
	int l2=0;
	while(1){
	l2=li;
	for(int i=0;i<n;i++)
	{
	if((a[i])>m){
		a[i] -= m;
		li=i;
	}
	}
	if(l2==li)
	break;
}
	cout<<li+1<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,m;
   cin>>n>>m;
   vector<pair<int,int >>v(n);
   for(int i=0;i<n;i++)
   {
       cin>>v[i].first;
       v[i].second=i;
   }
   int max=v[0].first;
  for(int i=0;i<n;i++)
  {
      if(max<v[i].first)
      max=v[i].first;
  }
   int k;
   k=max/m;

   {
     for(int i=0;i<n;i++)
     v[i].first=v[i].first-(k-1)*m;
     for(int i=n-1;i>0;i--)
     if( v[i].first>0)

     {
         cout<<i+1;
         break;
     }

   }

}

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,m,i,k,flag;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int a[n];
        int maxd = -1;
        flag=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if (a[i] > m) {//如果ai大于m 则flag标志为1
                if (a[i] / m > maxd) {//最后一个走的孩子具备两个条件
                    k = i; maxd = (a[i] - m) / m;//1.第一次站位最靠后 2.站到末尾次数最多
                }
                flag = 1;
            }

       }
    if(flag==0)
       printf("%d\n",n);
    else
        printf("%d\n",k+1);
    }

    return 0;
}

#include <iostream>
#include <string>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <queue>
#include <stack>
#include<sstream>
#include <vector>
#include<algorithm>
using namespace std;
#include <memory.h>
typedef int T;
int main(){

	T n, m;
	cin >> n >> m;
	T *arr = new T[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr, arr + n);

	cout << arr[n - 1] * m / 2;
	return 0;

}

#include<bits/stdc++.h>

#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
vector<int>vec;
int main()
{
    fastio;
    int n,m,Q_l,Q_h,Q3,Q4;
    cin>>n>>m;
    int X=n;
    vector<int>v(n);

    for(int i=0; i<n; i++)
        cin>>v[i];

    int Max=*max_element(v.begin(),v.end());
    if(Max%m==0){
        Q_h=Max;
        Q_l=Max-(m-1);
    }
    else{
int mod=Max/m;
       Q_h=Max ;
    Q_l=Max-(m-1);
   // cout<<Q_l<<endl;
    }

    int j=0;
    int cnt;
  for(j=n-1;j>=0;j--){
    if(v[j]>=Q_l && v[j]<=Q_h)  {cnt=j; break;}
  }
     cout<<cnt+1<<endl;
}

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<queue>
#include <vector>
#include <cstring>
#include <stack>
using namespace std;
typedef __int64 ll;
int a[110];
queue<int>q;
int main(){
    while(q.empty())q.pop();
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]);
        q.push(i);
    }
    int s = 0;
    while(!q.empty()){
        int t = q.front();
        //cout<<t<<endl;
        q.pop();
        if(m < a[t]){
            s = t;
            a[t] -= m;
            q.push(t);
        }
    }
    printf("%d\n",s);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fori0(x) for(int i=0;i<x;i++)
#define forj0(x) for(int j=0;j<x;j++)
#define fork0(x) for(int k=0;k<x;k++)
#define fori1(x) for(int i=1;i<=x;i++)
#define forj1(x) for(int j=1;j<=x;j++)
#define fork1(x) for(int k=1;k<=x;k++)
#define foriv(v) for(int i=0;i<v.size();i++)
#define forjv(v) for(int j=0;j<v.size();j++)
#define forkv(v) for(int k=0;k<v.size();k++)
#define testcase(t) for(int te=1;te<=t;te++)
#define nl "\n"
#define newl cout<<"\n"
#define print1(x) cout<<x<<"\n"
#define print2(x,y) cout<<x<<" "<<y<<"\n"
#define sorti(v) sort(v.begin(), v.end())
#define sortd(v) sort(v.begin(),v.end(), greater<int>())
#define ff first
#define ss second
#define test printf("test")
#define printv(v) for(int i=0;i<v.size();i++){cout<<v[i]<<" ";}cout<<"\n"
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector< pair<int,int> > vpi;
typedef vector< vi > vvi;
typedef vector< pair<ll,ll> > vpl;
typedef map<int,int> mapi;
typedef map<ll,ll> mapll;
#define intScan(t) scanf("%d",&t)

int main()
{
    int n,m;
    cin >> n >> m;

    vector<int> arr(n);

    fori0(n)
    {
        cin >> arr[i];
    }

    int a = *max_element(arr.begin(), arr.end());
    if(a%m > 0)
    {
        int j = 0;
        fori0(n)
        {
            if(arr[i] == a)
                j = i+1;
        }

        cout << j << endl;
        return 0;
    }
    else if(a%m == a)
    {
        int j = 0;
        fori0(n)
        {
            if(arr[i] == a)
                j = i+1;
        }

        cout << j << endl;
        return 0;
    }

    else
        a = (a/m)-1;

    vector<int> num;
    fori0(n)
    {
        if( (arr[i]/m == a) && (arr[i]%m > 0))
            num.pb(i+1);
    }

    cout << *max_element(num.begin(), num.end()) << endl;

}

#include<iostream>
#include<algorithm>
using namespace std;
int a[100+10];
int main(){
    int n,m,x=0;
   cin>>n>>m;
   x=m;
   for(int i=0;i<n;i++){
   	cin>>a[i];
   	x=x-a[i];
   	if(x<0){
   		cout<<i+1;
   		return 0;
	   }
	   x+=m;
   }
   cout<<n;
   return 0;
}

/* ak 47s, mac 11's,glocks and 9's*/

#include <bits/stdc++.h>

typedef unsigned long long ll;

using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define repu(v,s,e) for(ll v=s;v<e;v++)

ll n,m,a[100],i,max1,ix;
int main(){
	fastio
    cin>>n>>m;
    max1=0;
    ix=0;
    for(i=0;i<n;i++){
		 cin>>a[i];
		a[i] = ceil(a[i]/m);
	}
	for(i=0;i<n;i++)
    {
		if(a[i]>=max1)
		{
			max1=a[i];
			ix=i;
		}
	}
	cout<<ix+1<<endl;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    int *arr = new int[n];
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }

    int max = 0;
    int maxx;
    for (int i = 0; i < n; i++){
        if (arr[i]>=max){
            arr[i] = max;
            maxx = i;
        }

    }
    cout << maxx;
    }

#include<iostream>
#include<string>
#include<algorithm>
#include<numeric>
#include<iomanip>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#define ll long long int
#define rep(i,j,k) for(ll i=j;i<k;i++)
using namespace std;
ll n,m,*x,last;
bool negative()
{
	rep(z,0,n)if(x[z]>0)return false;
	return true;
}
int main()
{

	cin>>n>>m;
	x = new ll[n];
	rep(i,0,n)cin>>x[i];
	rep(i,0,n)
	{
		rep(j,0,n)if(x[j]>0)x[j]-=m,last=j+1;
		if(negative())return cout<<last,0;
	}
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a,last;
	cin>>n>>m;
	float cola[n];

	for(int i=0;i<n;i++){
		cin>>a;
		cola[i] = m%a;
	}

	for(int i=0;i<n;i++){
		if(cola[i]!=0)
			last = i;
	}
	cout<<last+1<<"\n";

		return 0;
}
	/*m % ai
6 4
1 1 2 2 3 3

5 2
1 3 1 4 2

*/

#include <iostream>
#include<string>

using namespace std;

int main () {

    int s, n;
    int max;
    int last;
    int k=0;

    cin>> s>>n;

     int *a = new int[s];

     for (int i = 0; i < s; i++){
     cin >> a[i];
     }

     max = n;

     if(n>0){
         for(int i=0; i<s; i++){
         if(a[i] >= max){
             max= a[i]; last =i+1;
             k++;
         }
         }

         if(k==0) last = s;

         }

     else{
         last =0;
     }

     cout<<last<<endl;

return 0;
}

#include <iostream>
//#include <cstring>
#include <vector>
#include <algorithm>
//#include <string>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];

    }
    int ans=a[0];
    int count;
     for(int i=1;i<n;i++)
    {
        if(a[i]/m >=ans/m)
        {ans=a[i];
            count=i+1;
        }
    }
    cout<<count;

}

#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

const int MAX_N = 100000;
int a[MAX_N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m, t, ans, curr = 0;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> t;
        if (t / m + (t % m ? 1 : 0) >= curr)
        {
            curr = t / m;
            ans = i;
        }
    }
    cout << ans + 1;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#include <stdlib.h>
#include <vector>
#define pi acos(-1)
#define MOD 1000000007
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
///s1.substr(1,3);///STARTING FROM INDEX 1, 3 LNEGTH SUBSTRING.
///s1.find("adn")///RETURNS STARTING INDEX OF THE SUBSTRING
///"adn" IF IT EXISTS IN THE STRING S1.///
///s1.find("adn",int pos);///RETURNS STARTING INDEX OF THE
///SUBSTRING "adn" SEARCHING FROM INDEX POS OF STRING s1.///
///string::npos returns a garbage value if not found...
///reverse(s1.begin(),s1.end())-> to reverse a string.
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gcd(a,b) __gcd(a,b)
using namespace std;

//vector<int>prime(8000000,0);
vector<bool>mark(100000000,false);
int prime[8000000];
int nprime;

void sieve(int n)
{
    int limit=sqrt(n*1.0)+1,s=0;nprime=0;
    mark[1]=true;///1 if not prime.
    mark[2]=false;prime[nprime++]=2;//cout<<2<<endl;
    for(int i=4;i<=n;i+=2)mark[i]=true;
    for(int i=3;i<=n;i+=2){
        if(!mark[i]){prime[nprime++]=i;//cout<<i<<endl;
        if(i<=limit){///karon limit er upor theke n porjonto not prime gula already cuta hoise.
            for(int j=i*i;j<=n;j+=i*2){
                mark[j]=true;
            }
          }
        }
    }
    //puts("2");
    //cout<<nprime<<endl;
    for(int i=1;i<=nprime;i+=100)cout<<prime[i-1]<<endl;
    //return nprime;
}
int l1[100005],l2[100005];
int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    ll t,i,q,n,k,l,c,d,p,nl,np,a,e,m,b=0,x1=1000000005,x3=0,x4=0,x5=0,x6=0;
    //double x10=0;
    //string s2,s3,s4,s5,s6,s7;
    //map<ll,ll>m1,m2;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a;
        if(a>m)b=i;
    }
    if(b!=0)cout<<b<<endl;
    else cout<<n<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define N 2000005

int main() {
    ll t=1;
    // cin>>t;
    while(t--) {
        ll n,m,i;
        cin>>n>>m;
        ll a[n];
        for(i=0;i<n;i++) {
            cin>>a[i];
        }
        ll nochange=0,last=0;
        do {
            nochange=0;
            for(i=0;i<n;i++) {
                if(a[i]>=0) {
                    last = i+1;
                    a[i]-=m;
                    nochange++;
                }
            }
        }while(nochange!=0);
        cout<<last<<"\n";
    }
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
main(){
    long long n,m,jac=-1,caj=-1,a;
    cin>>n>>m;
    for(int i = 0;i < n;i++){
        cin >> a;
        if(a + m - 1 / m >= jac){
            jac = (a + m - 1) / m;
            caj = i;
        }
    }
    cout<<caj+1;
}

#include <bits/stdc++.h>
using namespace std;

int a, c[100000], m, mx = -100;
map <int, int> f;

int main(){
	cin >> a >> m;
	for(int i = 0;i<a;i++){
		cin >> c[i];
		mx = max(mx, c[i]);
	}
	int l;
	for(int i = mx;;i--){
		if(i%m==0){
			if(mx%m==0){
				l = i;
				break;
			}else{
				l = i+1;
				break;
			}

		}
	}
	for(int i = a-1;i>=0;i--){
		if(c[i]>=l){
			cout << i+1;
			return 0;
		}
	}
}

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n;
	cin>>n;
	int m;
	cin>>m;
	int a[n];
	pair <int ,int> p[n+1];
	for(int i=1;i<=n;i++){
	cin>>p[i].first;
	a[i]=p[i].first;
	p[i].second =i;
}

	sort(p,p+n);
	int max1 = *std::max_element(a,a+n);
for(int i=n;i>=1;i--){
if(max1==p[i].first)
{
	cout<<p[i].second<<"\n";
	break;
}
}
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,input,m;
	vector <int> v;
	cin>>n>>m;
	while(n--)
	{
		cin>>input;
		v.push_back(input);
	}
	int mx= max_element(v.rbegin(),v.rend()) - v.rbegin();
	cout<<v.size() - mx;
	return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

int arr[105];

int main()
{
	int n;
	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}

	sort(arr,arr+n);

	for(int i=0;i<n;i++)
		cout<<arr[i]<<" ";

	return 0;
}

#include <iostream>
using namespace std;
int d[100];
int e[100];
int f=0;
int y=0;
int p=0;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>=101)
    {
        return 0;
    }

    for(int i=0;i<a;i++)
    {
        cin>>d[i];
    }

    for(int i=0;i<100;i++)
    {
        p=0;

        int x=d[i]-b;
        if(x<=0)
        {
            d[i]=0;
        }
        if(x>=1)
        {
            d[i]=d[i]-b;
        }

            for(int r=0;r<a;r++)
        {
            if(d[r]==0)
            {
                p++;
            }
        }

        if(d[i]>=f)
        {
            f=d[i];
            y=i;
        }

        if(p==a)
        {
            break;
        }

    }
    cout<<y+1<<endl;
}

#include<iostream>
using namespace std;
int main()
{
    int i,k;
    int a[110];
    int n,m;
    int max,pos;
    while(cin>>n>>m)
    {
        max=0;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
            if(a[i]>=max)
            {
                max=a[i];
                pos=i;
            }
        }
        if(max<=m)
        {
            cout<<n<<endl;
        }
        else
        {
            pos=0;
            k=max/m;
            m=k*m;
            for(i=1;i<=n;i++)
            {
                a[i]=a[i]-k;
                if(a[i]>0)
                {
                    pos=i;
                }
            }
            if(pos==0)
            {
                for(i=1;i<=n;i++)
                {
                    if(a[i]==0)
                    {
                        pos=i;
                    }
                }
            }
            cout<<pos<<endl;
        }
    }
    return 0;
}

#include <iostream>
using namespace std;

int main() {

    int n, m;

    cin>>n>>m;

    int x[n];
    int max=-1;
    for(int i=0;i<n;i++){
        cin>>x[i];
        if(x[i]>max)max=x[i];
    }

    for(int i=n-1;i>=0;i--){
        if(x[i]==max){cout<<i+1;break;}
    }

    return 0;
}

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,i,j,k,max1,min1,ans,m;
    cin>>n>>m;
    ans=0; k=0; max1=0;
    int a[10000],b[10000];
    for (int i=1;i<=n;i++)
    {
        cin>>j;
        max1=k;
        if (j%m==0) k=j/m; else k=j/m+1;
        if (k>=max1) ans=i;
    }
    cout<<ans;
}

#include<stdio.h>

int main()
{
    int a[1000];
    int n,m,i,max=0,dem=0;
    scanf("%d",&n);
    scanf("%d",&m);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
                   if(a[i]>=max)
                   {
                               max=a[i];
                               dem=i+1;
                   }
    }
    printf("%d",dem);

return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n,m,flag = 0;
	cin >> n >> m;
	std::vector<int> a,b;
	for(int i = 1;i <= n;i++)
	{
		int temp;
		cin >> temp;
		a.push_back(temp);
		b.push_back(i);
	}
	for(int i = 1;i <= a.size();i++)
	{
		if(a[i] > m)
		{
			a.push_back(a[i] - m);
			b.push_back(b[i]);
			flag = 1;
		}
	}
	if(flag == 0)
		cout << n << endl;
	else
		cout << b[b.size()-1] << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n,max1=0,m,k,i,a;
 cin>>n>>m;
 for(i=0;i<n;i++)
 {
     cin>>a;
if(ceil(a/m) >=max1)
{
max1=ceil(a/m);
k=i;
}
}
 cout<<k;
 return 0;
}

#include <iostream>

using namespace std;

int main()
{

    int n,m,c,r=0;
    cin>>n>>m;
    int x[n],p[n];
    int i=0;
    for( i=0;i<n;i++){
        cin>>p[i];
        if(p[i]>m){
            x[r]=p[i];
            r++;
        }
    }
    if(r==0||i==1){
        cout<<n;
        return 0;
    }
    int l=0,count1=0;
    bool k=true;
    for(int i=0;i<r;i++){
            k=true;
        l=x[i]-m;
        if(l<=m&&count1==0){
            c=x[i];
        }
        if(l>m){
            k=false;
        }
        for(int s=2;s<n;s++){
            if(k==true){
                break;
            }
            l-=m;
        if(s>=count1){
            count1=s;
            c=x[i];
        }
        if(l<=m){
                break;
            }
    }
    }
    for(int o=n-1;0<=o;o--){
        if(p[o]==c){
            c=o+1;
            cout<<c;
            return 0;
        }

    }
    return 0;
    }