#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, int>& p1, const pair<int, int>& p2) {
  return p1.first < p2.first;
}
struct node {
  int a;
  int b;
};
bool operator<(const node& x, const node& y) { return x.a > y.a; }
int sol(int x) {
  int ans = 0;
  if (x == 0) return 10;
  if (x == 100) return 0;
  if (x % 10 == 0) return 10;
  while (x > ans) ans += 10;
  return ans - x;
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  priority_queue<node> q;
  for (int i = 0; i < n; i++) {
    int x;
    node xx;
    scanf("%d", &x);
    int z;
    z = sol(x);
    xx.a = z;
    xx.b = x;
    q.push(xx);
  }
  int ans = 0;
  while (k > 0 && !q.empty()) {
    int xx = q.top().a;
    int yy = q.top().b;
    if (xx > k) break;
    if (xx == 0) {
      ans += (yy / 10);
      q.pop();
      continue;
    }
    node my;
    my.b = yy + xx;
    my.a = sol(my.b);
    q.pop();
    q.push(my);
    k -= xx;
  }
  while (!q.empty()) {
    ans += (q.top().b) / 10;
    q.pop();
  }
  cout << ans << endl;
  return 0;
}
