#include <bits/stdc++.h>
using namespace std;
static const int MAXN = 1e5 + 10;
int n, k;
int ans;
int data[MAXN];
int has[MAXN];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &data[i]);
    ++has[data[i] % 10];
    ans += data[i] / 10;
  }
  for (int i = 1; i < 10; ++i) {
    int s = min(has[10 - i], k / i);
    k -= i * s;
    ans += s;
    if (s != has[10 - i]) break;
  }
  ans += min(10 * n - ans, k / 10);
  printf("%d", ans);
}
