#include <bits/stdc++.h>
using namespace std;
int a[100050];
long long sum;
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = a[i] % m;
    if (a[i] == 0) {
      i--;
      n--;
      ans++;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      sum = 0;
      for (int k = i; k <= j; k++) {
        sum += a[k];
      }
      if (sum % m == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
