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