#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const int N = 2e5 + 5;
const double pi = acos(-1);
int n, m, x;
deque<pair<long long, long long>> dq;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    dq.push_back({x, i});
  }
  while (dq.size() > 1) {
    if (dq.front().first <= m)
      dq.pop_front();
    else {
      pair<long long, long long> p = dq.front();
      p.first -= m;
      dq.pop_front();
      dq.push_back(p);
    }
  }
  cout << dq.front().second + 1 << endl;
  return 0;
}
