#include <bits/stdc++.h>
using namespace std;
int dp[10000][10000];
int main() {
  int n, m;
  cin >> n >> m;
  int a[10000];
  long long cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i][i] = a[i] % m;
    if (dp[i][i] == 0) cnt++;
    for (int j = i + 1; j < n; j++) {
      dp[i][j] = (dp[i][j - 1] + a[j]) % m;
      if (dp[i][j] == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
