#include <bits/stdc++.h>
struct list {
  int stat, num;
  bool operator()(list p, list q) {
    if (p.num != q.num) return p.num > q.num;
    return p.stat > q.stat;
  }
} A[100505];
int N, K;
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i].stat);
    A[i].num = A[i].stat % 10;
  }
  std::sort(A, A + N, list());
  for (int i = 0; i < N; i++) {
    if (A[i].stat == 100) continue;
    if ((10 - A[i].num) <= K) {
      K -= (10 - A[i].num);
      A[i].stat += (10 - A[i].num);
    }
  }
  for (int i = 0; i < N; i++) {
    while ((K / 10) >= 1 && A[i].stat <= 90) A[i].stat += 10, K -= 10;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (A[i].stat / 10);
  }
  printf("%d\n", ans);
  return 0;
}
