#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const long long oo = ((long long)1e18) + 7;
int N, M, T, K, Q;
int A[MAXN];
namespace SUBTASK_1 {
void SOLVE() {}
}  // namespace SUBTASK_1
namespace SUBTASKFULL {
void SOLVE() {}
}  // namespace SUBTASKFULL
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  int ANS = 0;
  priority_queue<int> pq;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    ANS += A[i] / 10;
    if (A[i] % 10 != 0) {
      pq.push(A[i] % 10);
      A[i] += 10 - A[i] % 10;
    }
  }
  while (pq.size()) {
    int top = pq.top();
    pq.pop();
    if (K >= 10 - top) {
      K = K - 10 + top;
      ANS++;
    }
  }
  if (K >= 10) {
    for (int i = 1; i <= N; i++) {
      while (A[i] < 100 && K >= 10) {
        A[i] += 10;
        ANS++;
        K -= 10;
      }
    }
  }
  cout << ANS;
}
