#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long A[10002];
  long long sum[10002][10002] = {0};
  long long m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  int count = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      sum[i][j] = sum[i][j - 1] + A[j];
      if (sum[i][j] % m == 0) count++;
    }
  cout << count;
  return 0;
}
