#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t;
  cin >> n >> k;
  vector<int> a(n);
  set<int> s, b;
  for (int& t : a) cin >> t;
  while (k--) {
    cin >> t;
    b.insert(t);
  }
  for (int i = 0; i < n; i++) {
    if (i) a[i] += a[i - 1];
    s.insert(t - a[i]);
  }
  int answer = 0;
  for (int u : s) {
    set<int> h = b;
    for (int j : a) h.erase(j + u);
    if (h.empty()) answer++;
  }
  cout << answer << endl;
}
