#include <stdio.h>

int main() {
    int N, M;
    scanf("%d", &N); // Size of hash table
    scanf("%d", &M); // Number of keys to insert

    int table[N];
    for (int i = 0; i < N; i++) {
        table[i] = -1; // Initialize hash table as empty
    }

    int probes = 0;
    for (int i = 0; i < M; i++) {
        int key;
        scanf("%d", &key);

        int idx = key % N;
        int step = 1 + (key % (N - 1));
        int attempts = 0;

        // Try inserting
        while (table[idx] != -1) {
            probes++;  // Probe attempt
            attempts++;
            idx = (idx + step) % N; // Wrap around
        }

        probes++; // Count the successful probe
        table[idx] = key;
    }

    printf("%d\n", probes);
    return 0;
}
