#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, x;
int main() {
  cin >> n >> m;
  long long a[n], b[n];
  memset(b, 0, sizeof(b));
  cin >> a[0];
  b[0] = a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    b[i] = b[i - 1] + a[i];
  }
  for (int i = 0; i < n; i++) {
    if (b[n - 1] - b[i] + a[i] < m) break;
    for (int j = i; j < n; j++) {
      if ((b[j] - b[i] + a[i]) % m == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
