Right. You can't bid 2C with the first hand or 2D with the second. But here you don't need to. Just bid 3N with either of these hands.
If your hand was stronger and you want to play in slam in a minor if partner has support, you have a more difficult problem.
Say you held:
S x H Axx D AJxxxx C Axx
Now you want to play 6D if partner has support for diamonds and 3N if not. Unfortunately, SAYC - Basic has no method of showing a single minor with slam interest after the 1N opening. The best you can do is bid 2C followed by 3D. This sequence is game forcing showing a 4 card major and 5 or more card diamond suit. If partner obliges by bidding 4D, you can 6D.