#include <bits/stdc++.h>
using namespace std;
int n, k;
int a, total = 0;
int cnt[10] = {0};
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    cnt[(100 - a) % 10]++;
    total += a / 10;
  }
  for (int i = 1; i <= 9; i++) {
    if (k >= cnt[i] * i) {
      total += cnt[i];
      k -= cnt[i] * i;
    } else {
      total += k / i;
      k %= i;
    }
  }
  total += k / 10;
  printf("%d\n", min(total, n * 10));
  return 0;
}
