#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 333;
const long long linf = 1e18 + 333;
const int N = 1e5 + 5;
int n, k;
int a[N];
vector<int> cnt[15];
int main() {
  scanf("%d %d", &n, &k);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[10 - (x % 10)].push_back(x);
    ans += x / 10;
  }
  for (int i = 1; i <= 9; i++) {
    while (k >= i and cnt[i].size()) {
      int x = cnt[i].back();
      cnt[i].pop_back();
      x = x - (x % 10) + 10;
      k -= i;
      ans++;
      cnt[10].push_back(x);
    }
  }
  while (k >= 10 and cnt[10].size()) {
    int x = cnt[10].back();
    cnt[10].pop_back();
    if (x == 100) continue;
    k -= 10;
    ans++;
    cnt[10].push_back(x + 10);
  }
  printf("%d\n", ans);
  return 0;
}
