#include <bits/stdc++.h>
using namespace std;
int const MAXN = 100;
int arr[MAXN]{};
bool win(int n) {
  char s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == '1') {
      ans++;
    }
  }
  return ans != n;
}
int main() {
  int n, d;
  cin >> n >> d;
  int ans = 0;
  int temp = 0;
  for (int i = 0; i < d; i++) {
    if (win(n)) {
      temp++;
    } else {
      temp = 0;
    }
    if (temp > ans) ans = temp;
  }
  cout << ans << endl;
  return 0;
}
