#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n], cum[n + 1];
  cum[0] = 0;
  for (int i = 0; i < n; i++) cin >> arr[i], cum[i + 1] = cum[i] + arr[i];
  int b[k];
  unordered_map<int, int> m;
  unordered_map<int, int> chk;
  for (int i = 0; i < k; i++) cin >> b[i], m[b[i]] = 1;
  unsigned long long ans = 0;
  for (int i = 0; i < n; i++) {
    int val = b[0] - cum[i + 1], c = val, cnt = 0;
    for (int i = 0; i < k; i++) m[b[i]] = 1;
    for (int i = 0; i < n; i++) {
      val += arr[i];
      if (m[val]) cnt++, m[val] = 0;
    }
    if (cnt == k && !chk[c]) ans++, chk[c] = 1;
  }
  cout << ans << "\n";
  return 0;
}
