#include <bits/stdc++.h>
using namespace std;
priority_queue<int> qu;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long sum = 0;
  int x = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    sum += x / 10;
    x = x % 10;
    if (x) qu.push(x);
  }
  while (!qu.empty() && k) {
    int y = qu.top();
    qu.pop();
    if (k >= 10 - y) {
      k = k - (10 - y);
      sum++;
    }
  }
  if (k) sum += k / 10;
  if (n * 10 < sum)
    cout << 10 * n << endl;
  else
    cout << sum << endl;
  return 0;
}
