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