#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, ans;
  cin >> n >> m;
  queue<pair<int, int>> q;
  for (int i = 0; i < n; i++) {
    cin >> x;
    q.push({x, i + 1});
  }
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    if (q.empty()) {
      ans = p.second;
      break;
    }
    if (p.first > m) q.push({p.first - m, p.second});
  }
  cout << ans;
  return 0;
}
