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