#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)1e5;
int main() {
  int n, k;
  vector<int> r[10] = {};
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    r[a % 10].push_back(a);
  }
  for (int i = 9; i > 0; i--) {
    for (int j = r[i].size() - 1; j >= 0; j--) {
      if (k >= 10 - i) {
        k -= 10 - i;
        r[0].push_back(r[i][j] + 10 - i);
        r[i].pop_back();
      }
    }
  }
  for (int j = 0; j < r[0].size(); j++) {
    int x = min(k / 10, 10 - r[0][j] / 10);
    k -= 10 * x;
    r[0][j] += 10 * x;
  }
  int res = 0;
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < r[i].size(); j++) res += r[i][j] / 10;
  cout << res;
  return 0;
}
