#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
const int inf = 1e9 + 7;
struct node {
  int two, five;
} bag[maxn];
int sum;
void findcnt(int i, long long val) {
  int cnt1 = 0;
  while (val % 2 == 0) {
    cnt1++;
    val /= 2;
  }
  bag[i].two = cnt1;
  cnt1 = 0;
  while (val % 5 == 0) {
    cnt1++;
    val /= 5;
  }
  bag[i].five = cnt1;
  sum += cnt1;
  return;
}
int dp[6000][205];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  long long temp;
  sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &temp);
    findcnt(i, temp);
  }
  for (int i = 0; i <= sum; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = -inf;
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int s = sum; s >= bag[i].five; s--) {
      for (int j = k; j >= 1; j--) {
        if (dp[s - bag[i].five][j - 1] != -inf || s == bag[i].five)
          dp[s][j] = max(bag[i].two + dp[s - bag[i].five][j - 1], dp[s][j]);
      }
    }
  }
  int ans = 0;
  for (int i = sum; i >= 0; i--) ans = max(min(dp[i][k], i), ans);
  printf("%d\n", ans);
}
