#include <bits/stdc++.h>
using namespace std;
const int _max = 1e5 + 10;
struct node {
  int a, b;
  bool operator<(const node& y) const { return b > y.b; }
} skill[_max];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &skill[i].a);
    skill[i].b = skill[i].a % 10;
    skill[i].a /= 10;
  }
  sort(skill, skill + n);
  for (int i = 0; i < n; i++)
    if (skill[i].b && k + skill[i].b >= 10)
      k -= (10 - skill[i].b), skill[i].a++;
    else if (skill[i].b)
      break;
  k /= 10;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (skill[i].a < 10 && k + skill[i].a >= 10)
      k -= (10 - skill[i].a), skill[i].a = 10;
    else if (skill[i].a < 10)
      sum += k, k = 0;
    sum += skill[i].a;
  }
  printf("%d", sum);
  return 0;
}
