#include <bits/stdc++.h>
using namespace std;
int dp[205][10050] = {0};
int main() {
  memset(dp, 0x80, sizeof(dp));
  dp[0][0] = 0;
  int n, k;
  scanf("%d%d", &n, &k);
  int s = 0;
  for (int i = 1; i <= n; i++) {
    long long num;
    scanf("%I64d", &num);
    int n2 = 0, n5 = 0;
    for (; !(num % 5); num /= 5) n5++;
    for (; !(num % 2); num /= 2) n2++;
    s += n2;
    for (int j = min(i, k); j >= 1; j--)
      for (int l = s; l >= n2; l--)
        dp[j][l] = max(dp[j][l], dp[j - 1][l - n2] + n5);
  }
  int ans = 0;
  for (int i = 1; i <= s; i++) ans = max(ans, min(i, dp[k][i]));
  printf("%d\n", ans);
  return 0;
}
