#include <bits/stdc++.h>
using namespace std;
int n, k;
struct unit {
  int rat;
  int pnt;
} a[100009];
int points_left = 0;
int ans = 0;
bool cmp(unit a, unit b) { return a.pnt > b.pnt; }
void Read() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[i].rat = x / 10;
    points_left += 10 - a[i].rat;
    ans += a[i].rat;
    a[i].pnt = x % 10;
  }
}
void Solve() {
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (10 - a[i].pnt <= k && a[i].rat != 10) {
      k -= 10 - a[i].pnt;
      ans++;
      points_left--;
    }
  }
  ans += min(k / 10, points_left);
  printf("%d\n", ans);
}
int main() {
  Read();
  Solve();
  return 0;
}
