#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

int dp[100010][100010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;
    vi sweets(n);
    rep(i,n) cin >> sweets[i];
    ll ans = 0;
    rep(i,n){
        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;
}