#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
double pi = 3.1415926535;
long long num_generator() { return rand() % 1000; }
void array_generator(long long a[], long long n) {
  for (long long i = 0; i < n; i++) a[i] = rand() % 100;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  deque<pair<long long, long long> > dq;
  long long x;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    dq.push_back({x, i});
  }
  long long ans;
  while (!dq.empty()) {
    if (dq.size() == 1) {
      ans = dq.front().second + 1;
      break;
    }
    if (dq.front().first <= m)
      dq.pop_front();
    else {
      dq.front().first -= m;
      long long a = dq.front().first, b = dq.front().second;
      dq.pop_front();
      dq.push_back({a, b});
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
