#include <bits/stdc++.h>
const int maxn = 100010;
using namespace std;
int n, k, ans;
struct data {
  int num, t;
} a[maxn];
bool cmp1(data a, data b) { return a.t > b.t; }
bool cmp2(data a, data b) { return a.num < b.num; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i].num), a[i].t = a[i].num % 10, ans += a[i].num / 10;
  sort(a + 1, a + 1 + n, cmp1);
  for (int i = 1; i <= n && a[i].t > 0; i++) {
    if (k < 10 - a[i].t) break;
    ans++, k -= (10 - a[i].t), a[i].num += (10 - a[i].t), a[i].t = 0;
  }
  if (k < 10) {
    printf("%d\n", ans);
    return 0;
  }
  sort(a + 1, a + 1 + n, cmp2);
  for (int i = 1; i <= n && a[i].num < 100; i++) {
    if (k < 100 - a[i].num) {
      ans += k / 10;
      break;
    }
    k -= 100 - a[i].num, ans += (100 - a[i].num) / 10, a[i].num = 100;
  }
  printf("%d\n", ans);
  return 0;
}
