#include <bits/stdc++.h>
using namespace std;
void make_unique(vector<long long> vec) {
  sort((vec).begin(), (vec).end());
  vec.resize(unique((vec).begin(), (vec).end()) - vec.begin());
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    long long sum = 0, ans = 0, x, y, k, h, a, c, n, t, m, i, j, flag = 0,
              count = 0, moves = 0;
    cin >> n >> m;
    deque<pair<long long, long long> > dq;
    for (i = 0; i < n; i++) {
      long long x;
      cin >> x;
      dq.push_back({i + 1, x});
    }
    while (dq.size() != 0) {
      if (dq.size() == 1) {
        cout << dq.front().first << '\n';
        break;
      }
      if (dq.front().second <= m) {
        dq.pop_front();
      } else if (dq.front().second > m) {
        long long s = dq.front().second;
        long long f = dq.front().first;
        dq.pop_front();
        dq.push_back({f, s - m});
      }
    }
  }
  return 0;
}
