#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 2;
int n, k, i, j, sum;
struct Mod_10 {
  int x, rest;
  bool operator<(const Mod_10 &b) const {
    return rest < b.rest || (rest == b.rest && x < b.x);
  }
} a[Maxn];
int main() {
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i].x);
    a[i].rest = 10 - a[i].x % 10;
    if (a[i].x == 100) a[i].rest = 0;
  }
  sort(a, a + n);
  j = 0;
  while (a[j].x == 100 && j < n) j++;
  for (i = j; i < n; i++) {
    if (k >= a[i].rest) {
      a[i].x += a[i].rest;
      k -= a[i].rest;
    } else
      break;
  }
  sum = 0;
  for (i = 0; i < n; i++) sum += a[i].x / 10;
  if (n * 10 - sum > k / 10)
    sum += k / 10;
  else
    sum = n * 10;
  printf("%d\n", sum);
  return 0;
}
